home · contact · privacy
Identify "playing" entry in playlist by playlist.idx rather than digest, to avoid...
authorChristian Heller <c.heller@plomlompom.de>
Tue, 17 Dec 2024 00:34:01 +0000 (01:34 +0100)
committerChristian Heller <c.heller@plomlompom.de>
Tue, 17 Dec 2024 00:34:01 +0000 (01:34 +0100)
src/templates/playlist.tmpl
src/ytplom/http.py
src/ytplom/misc.py

index eed3d1e94fcbee0d3a4e0d347de2e81e508beabc..ad5c18b250e2b45b94a8ded04b7d65e9e5826b84 100644 (file)
@@ -23,7 +23,7 @@ event_handlers.push(function(data) {  // update playlist
         tr.classList.add(CLS_PLAYLIST_ROW);
         const td_entry_control = new_child_to('td', tr);
         td_entry_control.classList.add('entry_control');
-        if (data.title_digest == file.digest) {
+        if (i == data.idx) {
             td_entry_control.textContent = 'playing'; }
         else {
             for (const [symbol, prefix] of [['>', 'jump'],
index 165e5eb5d0716ba760728a7537ed98272838c709..6ccf282a5088e4eef51d6134dd7c196040fe1df5 100644 (file)
@@ -410,7 +410,7 @@ class _TaskHandler(BaseHTTPRequestHandler):
                     'last_update': self.server.player.last_update,
                     'running': self.server.player.is_running,
                     'paused': self.server.player.is_paused,
-                    'title_digest': digest,
+                    'idx': self.server.player.idx,
                     'title_tags': tags,
                     'title': title}
                 if 'playlist' in params.as_dict:
index 81406d06ec18bb6ffdf531d4e888e2f5afdd038b..367177964ed7e3f0e28a17d93e524cc4ef92f675 100644 (file)
@@ -620,6 +620,11 @@ class Player:
         self._kill_mpv()
         self._start_mpv()
 
+    @property
+    def idx(self) -> int:
+        """Read-only access to ._idx."""
+        return self._idx
+
     @property
     def empty(self) -> bool:
         """Return if playlist empty."""