const RETRY_INTERVAL_S = 5;
const PATH_EVENTS = '/{{page_names.events}}';
const PATH_PLAYER = '/{{page_names.player}}';
+const PATH_PLAYLIST = '/{{page_names.playlist}}';
+const PATH_PREFIX_FILE = '/{{page_names.file}}/';
var event_handlers = [];
var events_params = '';
send_to({command: [command]}, PATH_PLAYER); }
event_handlers.push(function(data) { // update player state
- const state_desc = data.running ? (data.paused ? 'paused' : 'playing') : 'stopped';
- for (const [id, text] of [['player_state', `${state_desc}: ${data.title}`],
+ for (const [id, text] of [['player_state', data.running ? (data.paused ? 'paused' : 'playing') : 'stopped'],
+ ['a_playing', data.title],
['btn_pause', data.paused ? 'resume' : 'pause'],
- ['btn_stop', data.running? 'stop' : 'play']]) {
- document.getElementById(id).textContent = text; }});
+ ['btn_stop', data.running ? 'stop' : 'play']]) {
+ document.getElementById(id).textContent = text; }
+ document.getElementById('a_playing').href = data.title_digest ? `${PATH_PREFIX_FILE}${data.title_digest}` : PATH_PLAYLIST ; })
{% block script %}
{% endblock %}
{{ macros.link_if("playlist" != selected, page_names.playlist) }}
· {{ macros.link_if("files" != selected, page_names.files) }}
· {{ macros.link_if("yt_queries" != selected, page_names.yt_queries, "queries") }}
-| <button onclick="player_command('prev')">prev</button>
+<hr />
+<button onclick="player_command('prev')">prev</button>
<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>
+<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>
<hr />
{% block body %}
{% endblock %}
'last_update': self.server.player.last_update,
'running': self.server.player.is_running,
'paused': self.server.player.is_paused,
+ 'title_digest': playing.digest.b64 if playing else '',
'title': str(playing.rel_path) if playing else 'none'}
if 'playlist' in params.as_dict:
data['playlist_files'] = [