audio files should not have aspect ratio

This commit is contained in:
j 2015-05-23 15:10:24 +05:30
parent 9191a9c196
commit 0504eaf227

View file

@ -616,6 +616,9 @@ class Item(models.Model):
if i['parts']:
i['videoRatio'] = streams[0].aspect_ratio
i['resolution'] = (streams[0].file.width, streams[0].file.height)
if i['resolution'] == (0, 0):
del i['resolution']
del i['videoRatio']
else:
i['duration'] = self.files.filter(
Q(selected=True)|Q(wanted=True)
@ -916,10 +919,11 @@ class Item(models.Model):
#s.duration = sum([v.duration for v in videos])
s.duration = sum([v.duration for v in self.streams()])
v = videos[0]
if v.is_audio:
if v.is_audio or not v.info.get('video'):
s.resolution = None
s.width = None
s.height = None
s.aspectratio = None
else:
s.resolution = v.width * v.height
s.width = v.width
@ -944,6 +948,7 @@ class Item(models.Model):
s.size = None
s.volume = None
s.parts = 0
s.aspectratio = None
for key in ('hue', 'saturation', 'lightness'):
if key in self.data: