add up volume for multi part files

This commit is contained in:
j 2012-11-10 00:28:34 +01:00
parent 43a12a1380
commit d4af01a905

View file

@ -790,7 +790,7 @@ class Item(models.Model):
s.bitrate = s.size * 8 / s.duration s.bitrate = s.size * 8 / s.duration
else: else:
s.bitrate = 0 s.bitrate = 0
s.volume = self.data.get('volume', 0) s.volume = self.data.get('volume', None)
else: else:
s.duration = None s.duration = None
s.resolution = None s.resolution = None
@ -1054,7 +1054,7 @@ class Item(models.Model):
color = [0, 0, 0] color = [0, 0, 0]
n = streams.count() n = streams.count()
for s in streams: for s in streams:
self.data['volume'] = s.volume * s.duration self.data['volume'] += s.volume * s.duration
color = map(lambda a,b: (a+b)/n, color,ox.image.getRGB(s.color)) color = map(lambda a,b: (a+b)/n, color,ox.image.getRGB(s.color))
offset += s.duration offset += s.duration
self.data['color'] = ox.image.getHSL(color) self.data['color'] = ox.image.getHSL(color)