self.copy = copy
self.link = link
- for soundfile in SoundFile.objects.select_related().exclude(podcastable=False):
+ for soundfile in SoundFile.objects.select_related():
if emission and soundfile.episode.emission.slug != emission:
continue
if episode and soundfile.episode.slug != episode:
continue
except ValueError: # no file associated with it
continue
+ if not soundfile.podcastable:
+ # get duration using initial file
+ if not soundfile.duration:
+ cmd = ['soxi', '-D', soundfile.file.path]
+ try:
+ soundfile.duration = int(float(subprocess.check_output(cmd)))
+ except (ValueError, subprocess.CalledProcessError):
+ pass
+ else:
+ soundfile.save()
+ continue
for format in formats.split(','):
file_path = soundfile.get_format_path(format)
created = False