fix hue, saturation, lightness calculation for multi part items

This commit is contained in:
j 2016-08-15 15:14:44 +02:00
parent 3d6d1be2e6
commit 0eb873d2cb

View file

@ -1335,7 +1335,7 @@ class Item(models.Model):
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 = [(a+b)/n for a, b in zip(color, ox.image.getRGB([1.0] * 3))] color = [(a+b)/n for a, b in zip(color, ox.image.getRGB(s.color or [0.0] * 3))]
offset += s.duration offset += s.duration
self.data['hue'], self.data['saturation'], self.data['lightness'] = ox.image.getHSL(color) self.data['hue'], self.data['saturation'], self.data['lightness'] = ox.image.getHSL(color)
if offset: if offset: