From: Guillaume Pellerin Date: Thu, 25 Dec 2014 21:33:26 +0000 (+0100) Subject: fix no duration X-Git-Tag: 2.8.1-pro~282^2~11 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=7249121d0040b952e7e38f53e30a370bc831a9d5;p=teleforma.git fix no duration --- diff --git a/teleforma/management/commands/teleforma-import-seminar-media-update.py b/teleforma/management/commands/teleforma-import-seminar-media-update.py index 6024e30c..023fff9b 100644 --- a/teleforma/management/commands/teleforma-import-seminar-media-update.py +++ b/teleforma/management/commands/teleforma-import-seminar-media-update.py @@ -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)