mediagoblin-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GMG-Devel] [PATCH] Do not fail if thumbnail was not created (fix for ti


From: Sergio Durigan Junior
Subject: [GMG-Devel] [PATCH] Do not fail if thumbnail was not created (fix for ticket #757)
Date: Sun, 15 Dec 2013 14:23:35 -0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux)

Hi there,

This simple patch came out of a discussion in the #mediagoblin channel.
Tran Thanh Bao helped me with most of the investigation, and Christopher
Webber suggested a way to improve the workaround found by Tran.  So I
went ahead and did what was proposed.

The problem is that I was unable to upload some kinds of formats (video
and audio) to my MG instance.  I was seeing the same error as
<https://issues.mediagoblin.org/ticket/757>, i.e., "Copying to public
storage failed.".  After a good deal of time spent in the investigation
of the issue, Tran found that the problem happened when MG tried to
generated the thumbnail of the video.  Specifically, gstreamer was
failing badly, but MG still assumed that the thumbnail was generated
correctly and tried to copy the (non-existent) file to another folder,
which lead to the error mentioned above.

The proposed fix is simple.  I just checked for the existence of the
thumbnail file (after the thumbnailing process was called), and if
nothing was found, the function just gives up (and thus uses the default
thumb image).  It is now working fine for me, for all the formats I have
tested.

OK to apply?  Thanks.

diff --git a/mediagoblin/media_types/video/processing.py 
b/mediagoblin/media_types/video/processing.py
index eb5a062..abd5f36 100644
--- a/mediagoblin/media_types/video/processing.py
+++ b/mediagoblin/media_types/video/processing.py
@@ -266,6 +266,11 @@ class CommonVideoProcessor(MediaProcessor):
             tmp_thumb,
             thumb_size[0])
 
+        # Checking if the thumbnail was correctly created.  If it was not,
+        # then just give up.
+        if not os.path.exists (tmp_thumb):
+            return
+
         # Push the thumbnail to public storage
         _log.debug('Saving thumbnail...')
         store_public(self.entry, 'thumb', tmp_thumb,


-- 
Sergio



reply via email to

[Prev in Thread] Current Thread [Next in Thread]