]> git.0d.be Git - django-panik-emissions.git/commitdiff
don't crash on soundfiles with no file associated
authorFrédéric Péters <fpeters@0d.be>
Sat, 21 Jul 2018 11:38:48 +0000 (13:38 +0200)
committerFrédéric Péters <fpeters@0d.be>
Sat, 21 Jul 2018 11:38:48 +0000 (13:38 +0200)
emissions/management/commands/create-sound-files.py
emissions/management/commands/create-sound-waveforms.py

index ee88827878d10047be6c21fb4a5076d8bb28c7b9..69f84c6f1c2dccbd1b30766b1b0beeab6be263b7 100644 (file)
@@ -44,7 +44,10 @@ class Command(BaseCommand):
                 continue
             if episode and soundfile.episode.slug != episode:
                 continue
-            if soundfile.file is None or not os.path.exists(soundfile.file.path):
+            try:
+                if soundfile.file is None or not os.path.exists(soundfile.file.path):
+                    continue
+            except ValueError:  # no file associated with it
                 continue
             for format in ('ogg', 'mp3'):
                 file_path = soundfile.get_format_path(format)
index a464e7474b07f8283076f6f594f8d307e73fd29a..619b0761b32512525f0150858333f9c03cf3b678 100644 (file)
@@ -37,7 +37,10 @@ class Command(BaseCommand):
                 continue
             if episode and soundfile.episode.slug != episode:
                 continue
-            if soundfile.file is None or not os.path.exists(soundfile.file.path):
+            try:
+                if soundfile.file is None or not os.path.exists(soundfile.file.path):
+                    continue
+            except ValueError:  # no file associated with it
                 continue
             file_path = soundfile.get_format_path('waveform.json')
             if os.path.exists(file_path) and not force: