]> git.0d.be Git - django-panik-nonstop.git/commitdiff
stamina: handle int durations
authorFrédéric Péters <fpeters@0d.be>
Thu, 9 Jul 2020 19:06:07 +0000 (21:06 +0200)
committerFrédéric Péters <fpeters@0d.be>
Thu, 9 Jul 2020 19:06:07 +0000 (21:06 +0200)
nonstop/management/commands/stamina.py

index 72cbb7e2ccc818f26cac345c7ca00c9f57540dbe..3c746e79057c4bbe76f37b8a9cf77007217cd9a9 100644 (file)
@@ -136,8 +136,10 @@ class Command(BaseCommand):
         if app_settings.DEBUG_WITH_SLEEPS:
             if hasattr(item, 'is_stream') and item.is_stream():
                 cmd = 'sleep 86400 # %s' % item.stream.url
-            else:
+            elif isinstance(item.duration, datetime.timedelta):
                 cmd = 'sleep %s # %s' % (item.duration.total_seconds(), item.file_path())
+            elif isinstance(item.duration, int):
+                cmd = 'sleep %s # %s' % (item.duration, item.file_path())
         else:
             cmd = [app_settings.PLAYER_COMMAND] + app_settings.PLAYER_ARGS
             if hasattr(item, 'is_stream') and item.is_stream():