]> git.parisson.com Git - teleforma.git/commitdiff
fix no duration
authorGuillaume Pellerin <yomguy@parisson.com>
Thu, 25 Dec 2014 21:33:26 +0000 (22:33 +0100)
committerGuillaume Pellerin <yomguy@parisson.com>
Thu, 25 Dec 2014 21:33:26 +0000 (22:33 +0100)
teleforma/management/commands/teleforma-import-seminar-media-update.py

index 6024e30c8bb3778d6b1b535734a1601ada3869ce..023fff9b0fd3d6dd99fa14bf55565463c94111c4 100644 (file)
@@ -79,13 +79,16 @@ class Command(BaseCommand):
             self.delete_media(preview)
 
     def get_duration(self, file):
-        decoder = timeside.decoder.FileDecoder(file)
-        decoder.setup()
-        # time.sleep(0.5)
-        value = str(datetime.timedelta(0,decoder.input_duration))
-        t = value.split(':')
-        t[2] = t[2].split('.')[0]
-        return ':'.join(t)
+        try:
+            decoder = timeside.decoder.FileDecoder(file)
+            decoder.setup()
+            # time.sleep(0.5)
+            value = str(datetime.timedelta(0,decoder.input_duration))
+            t = value.split(':')
+            t[2] = t[2].split('.')[0]
+            return ':'.join(t)
+        except:
+            return '0:0:0'
 
     def get_item(self, collection, id):
         items = MediaItem.objects.filter(collection=collection, code=id)