small diffusions' sound

This commit is contained in:
bkfox 2015-11-23 15:12:21 +01:00
parent 4291eea67e
commit 5109392db7

View File

@ -539,8 +539,9 @@ class Diffusion (models.Model):
Get total duration of the archives. May differ from the schedule
duration.
"""
sounds = self.initial.sounds if self.initial else self.sounds
r = [ sound.duration
for sound in self.sounds.filter(type = Sound.Type['archive'])
for sound in sounds.filter(type = Sound.Type['archive'])
if sound.duration ]
return utils.time_sum(r) if r else self.duration
@ -548,7 +549,8 @@ class Diffusion (models.Model):
"""
Return an ordered list of archives sounds for the given episode.
"""
r = [ sound for sound in self.sounds.all().order_by('path')
sounds = self.initial.sounds if self.initial else self.sounds
r = [ sound for sound in sounds.all().order_by('path')
if sound.type == Sound.Type['archive'] ]
return r