From 90a748879703ef9dc2c61920c1aaaa68e41efd67 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Sat, 8 Sep 2012 13:37:52 +0200 Subject: [PATCH] if info has duration of 0 or less use duratino from extracted streams (work around issues in upload process) --- pandora/archive/models.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pandora/archive/models.py b/pandora/archive/models.py index b07e4b1f..1abb77a8 100644 --- a/pandora/archive/models.py +++ b/pandora/archive/models.py @@ -453,6 +453,8 @@ class Stream(models.Model): self.info = ox.avinfo(self.video.path) self.oshash = self.info.get('oshash') self.duration = self.info.get('duration', 0) + if self.duration <= 0: + self.duration = sum([s.info['duration'] for s in self.streams.filter(source=None)]) if 'video' in self.info and self.info['video']: self.aspect_ratio = self.info['video'][0]['width'] / self.info['video'][0]['height'] else: