if info has duration of 0 or less use duratino from extracted streams (work around issues in upload process)

This commit is contained in:
j 2012-09-08 13:37:52 +02:00
parent 0151b282a2
commit 90a7488797
1 changed files with 2 additions and 0 deletions

View File

@ -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: