home · contact · privacy
In all-pages player control, show playing titles tags.
authorChristian Heller <c.heller@plomlompom.de>
Tue, 10 Dec 2024 16:14:20 +0000 (17:14 +0100)
committerChristian Heller <c.heller@plomlompom.de>
Tue, 10 Dec 2024 16:14:20 +0000 (17:14 +0100)
src/templates/_base.tmpl
src/ytplom/http.py

index 2161f8f79d4dd514c35d567269bdf5e0262335a9..cbda2ab2b37ce8767773034fd3b144ba9d25785d 100644 (file)
@@ -44,8 +44,9 @@ function player_command(command) {
     send_to({command: [command]}, PATH_PLAYER); }
 
 event_handlers.push(function(data) {  // update player state
-    for (const [id, text] of [['player_state', data.running ? (data.paused ? 'paused' : 'playing') : 'stopped'],
+    for (const [id, text] of [['playing_tags', data.title_tags ? `(tags: ${data.title_tags})` : ''],
                               ['a_playing', data.title],
+                              ['player_state', data.running ? (data.paused ? 'paused' : 'playing') : 'stopped'],
                               ['btn_pause', data.paused ? 'resume' : 'pause'],
                               ['btn_stop', data.running ? 'stop' : 'play']]) {
         document.getElementById(id).textContent = text; }
@@ -73,7 +74,7 @@ td, th { vertical-align: top; text-align: left; }
 <button onclick="player_command('next')">next</button>
 <button id="btn_pause" onclick="player_command('pause')"></button>
 <button id="btn_stop" onclick="player_command('stop')"></button>
-· <span id="player_state" /></span>: <a id="a_playing"></a>
+· <span id="player_state" /></span>: <a id="a_playing"></a> <span id="playing_tags"></span>
 <hr />
 {% block body %}
 {% endblock %}
index 4535361e1aa74ab0736f9e6992e4c83a963a0a97..f9e3b49c2126c4a7e5ee911957a182ce674b42d4 100644 (file)
@@ -382,6 +382,7 @@ class _TaskHandler(BaseHTTPRequestHandler):
                     'running': self.server.player.is_running,
                     'paused': self.server.player.is_paused,
                     'title_digest': playing.digest.b64 if playing else '',
+                    'title_tags': ', '.join(playing.tags) if playing else '',
                     'title': str(playing.rel_path) if playing else 'none'}
                 if 'playlist' in params.as_dict:
                     data['playlist_files'] = [