]> git.0d.be Git - django-panik-nonstop.git/commitdiff
stamina: adjust stream timeout for late starts
authorFrédéric Péters <fpeters@0d.be>
Thu, 21 May 2020 10:15:39 +0000 (12:15 +0200)
committerFrédéric Péters <fpeters@0d.be>
Thu, 2 Jul 2020 08:01:29 +0000 (10:01 +0200)
nonstop/management/commands/stamina.py

index 789e4a50d99a119f06da5a6aa6700ca2f7c41138..46495542b469b3ba3da7eaca64a40289a029a2c3 100644 (file)
@@ -119,7 +119,8 @@ class Command(BaseCommand):
             print(now, 'playing stream', slot.stream)
             # TODO: jingle
             cmd = 'sleep 86400 # stream'  # will never stop by itself
-            await self.player_process(cmd, timeout=slot.duration)
+            print('timeout at', (slot.end_datetime - now).total_seconds())
+            await self.player_process(cmd, timeout=(slot.end_datetime - now).total_seconds())
         else:
             print(now, 'playing sound', slot.episode)
             # TODO: jingle