Fix for issue 5070 gst incomplete file
authorayleph <ayleph@thisshitistemp.com>
Wed, 18 Nov 2015 04:56:31 +0000 (23:56 -0500)
committerChristopher Allan Webber <cwebber@dustycloud.org>
Thu, 19 Nov 2015 22:05:25 +0000 (16:05 -0600)
Seek tmp_media_file to 0 before attempting to discover the file type.
This prevents the following error when discovering mp4 video files.

"gst-stream-error-quark: This file is incomplete and cannot be played"

mediagoblin/media_types/__init__.py

index 97e4facd18b9e8549012062092702b2831d3843e..9f6043e9fbe0efa67e19f33546d6c5d48580471c 100644 (file)
@@ -146,6 +146,7 @@ def sniff_media(media_file, filename):
     tmp_media_file = tempfile.NamedTemporaryFile()
     shutil.copyfileobj(media_file, tmp_media_file)
     media_file.seek(0)
+    tmp_media_file.seek(0)
     try:
         return type_match_handler(tmp_media_file, filename)
     except TypeNotFound as e: