[GMG-Devel] [PATCH] Do not fail if thumbnail was not created (fixfor ticket #757))

Christopher Allan Webber cwebber at dustycloud.org
Thu Jan 2 12:38:44 EST 2014


Heya!  Sorry for the delay on replying to this.  This patch works
great... committed to master!

sergiodj at sergiodj.net writes:

> 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,



More information about the devel mailing list