]> git.0d.be Git - django-panik-emissions.git/commitdiff
create-sound-files: recompute duration if --force is given
authorFrédéric Péters <fpeters@0d.be>
Thu, 10 Oct 2019 15:04:03 +0000 (17:04 +0200)
committerFrédéric Péters <fpeters@0d.be>
Thu, 10 Oct 2019 15:04:03 +0000 (17:04 +0200)
emissions/management/commands/create-sound-files.py

index b34492215d23d9570643086b696ca98a5e3523d0..d79aec838c58cafa33f44a6a66cf94d391502e9c 100644 (file)
@@ -63,7 +63,7 @@ class Command(BaseCommand):
                     created = self.create(soundfile, format)
                 if created or reset_metadata:
                     self.set_metadata(soundfile, format)
-            if not soundfile.duration and os.path.exists(soundfile.get_format_path('ogg')):
+            if (force or not soundfile.duration) and os.path.exists(soundfile.get_format_path('ogg')):
                 cmd = ['soxi', '-D', soundfile.get_format_path('ogg')]
                 soundfile.duration = int(float(subprocess.check_output(cmd)))
                 soundfile.save()