]> git.0d.be Git - panikweb.git/commitdiff
display track metadata in player for playlist emissions
authorFrédéric Péters <fpeters@0d.be>
Wed, 10 May 2023 09:48:12 +0000 (11:48 +0200)
committerFrédéric Péters <fpeters@0d.be>
Wed, 10 May 2023 09:48:12 +0000 (11:48 +0200)
panikweb/views.py

index bfe49e1dc6875ea3cd7b5d01ba925a95a4bfc508..b1e5be594e8fd775f8b75018af2d1ac6a130e66b 100644 (file)
@@ -883,12 +883,15 @@ listen = Listen.as_view()
 class OnAir(View):
     def get_infos(self, ctx):
         infos = {}
+        include_track_metadata = settings.ONAIR_ALWAYS_INCLUDE_TRACK_METADATA
+
         if ctx.get('episode'):
             infos['episode'] = {
                 'title': ctx['episode'].title,
                 'subtitle': ctx['episode'].subtitle,
                 'url': ctx['episode'].get_absolute_url(),
             }
+
         if ctx.get('emission'):
             chat_url = None
             if ctx['emission'].chat_open:
@@ -900,7 +903,11 @@ class OnAir(View):
                 'url': ctx['emission'].get_absolute_url(),
                 'chat': chat_url,
             }
+            if ctx['current_slot'].recurringplaylistdiffusion_set.exists():
+                include_track_metadata = True
+
         if ctx.get('nonstop'):
+            include_track_metadata = True
             redirect_path = ctx['nonstop'].redirect_path
             infos['nonstop'] = {
                 'title': ctx['nonstop'].get_public_label(),
@@ -918,8 +925,10 @@ class OnAir(View):
                     'slug': ctx['current_slot'].slug,
                 },
             )
-        if ctx.get('nonstop') or settings.ONAIR_ALWAYS_INCLUDE_TRACK_METADATA:
+
+        if include_track_metadata:
             infos.update(get_current_nonstop_track())
+
         return infos
 
     def get(self, request, *args, **kwargs):