From: Christian Heller Date: Tue, 10 Dec 2024 16:14:20 +0000 (+0100) Subject: In all-pages player control, show playing titles tags. X-Git-Url: https://plomlompom.com/repos/%7B%7B%20web_path%20%7D%7D/%7B%7Bdb.prefix%7D%7D/static/%7B%7Bprefix%7D%7D/templates?a=commitdiff_plain;h=557418eb183e3b7a837123934396536b7369ab0f;p=ytplom In all-pages player control, show playing titles tags. --- diff --git a/src/templates/_base.tmpl b/src/templates/_base.tmpl index 2161f8f..cbda2ab 100644 --- a/src/templates/_base.tmpl +++ b/src/templates/_base.tmpl @@ -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; } -· : +· :
{% block body %} {% endblock %} diff --git a/src/ytplom/http.py b/src/ytplom/http.py index 4535361..f9e3b49 100644 --- a/src/ytplom/http.py +++ b/src/ytplom/http.py @@ -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'] = [