check that duration is no 0

This commit is contained in:
j 2011-09-30 15:46:26 +02:00
parent a15a8d8ded
commit 9b4c87b867

View file

@ -649,7 +649,10 @@ class Item(models.Model):
s.numberoffiles = self.files.all().count() s.numberoffiles = self.files.all().count()
s.parts = videos.count() s.parts = videos.count()
s.size = sum([v.size for v in videos]) #FIXME: only size of movies? s.size = sum([v.size for v in videos]) #FIXME: only size of movies?
s.bitrate = s.size * 8 / s.duration if s.duration:
s.bitrate = s.size * 8 / s.duration
else:
s.bitrate = 0
s.volume = 0 s.volume = 0
else: else:
s.duration = None s.duration = None