From a5fd39f2af0e299033fa552840960f2de81138e8 Mon Sep 17 00:00:00 2001 From: Honey Date: Tue, 21 Jul 2026 23:28:27 +0200 Subject: [PATCH] Make the progress bar purely decorative, drop live position tracking positionMs changes every poll (~20s), so the old live progress bar/elapsed time forced a full flash constantly, even mid-song -- this panel has no partial refresh, so there's no way to show real progress without that. Now it's an outline + total length only, driven by nothing that changes while the same track keeps playing. Verified the rendered image is byte-identical across different positionMs values for the same track. Also dropped elapsed/elapsed_text/progress_pct from the track dict entirely now that nothing renders them. --- screens/navidrome.py | 21 ++++++++------------- web/templates/settings_navidrome.html | 2 +- 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/screens/navidrome.py b/screens/navidrome.py index 1a257f5..4ec138e 100644 --- a/screens/navidrome.py +++ b/screens/navidrome.py @@ -138,12 +138,9 @@ class NavidromeScreen(Screen): def _build_track(self, entry: dict, settings: dict, idle: bool) -> dict: duration = int(entry.get("duration") or 0) if idle: - elapsed = 0 since = time.time() - float(settings.get("_last_track_at") or time.time()) minutes_ago = (int(since // 60) // 5) * 5 else: - elapsed = int((entry.get("positionMs") or 0) / 1000) - elapsed = min(elapsed, duration) if duration else elapsed minutes_ago = entry.get("minutesAgo") or 0 return { @@ -158,9 +155,6 @@ class NavidromeScreen(Screen): "minutes_ago": minutes_ago, "duration": duration, "duration_text": _format_time(duration), - "elapsed": elapsed, - "elapsed_text": _format_time(elapsed), - "progress_pct": (elapsed / duration) if duration else 0, } def _fetch_cover(self, settings: dict, cover_art_id: str): @@ -300,18 +294,19 @@ class NavidromeScreen(Screen): items.append((album_font.size * 1.4, draw_genre)) - if settings.get("show_progress", False) and not idle and track["duration"]: + if settings.get("show_progress", False) and track["duration"]: + # Purely decorative -- an outline, not a fill. This panel has no + # partial refresh, so anything tracking *live* playback position + # would change on every poll and force a full flash every ~20s + # even mid-song. Shows total length only, never changes while + # the same track keeps playing. bar_h = max(3, int(scale * 0.012)) bar_gap = status_font.size * 0.3 def draw_progress(yy, bar_h=bar_h, bar_gap=bar_gap): bar_y = yy + bar_gap - draw.rectangle((x, bar_y, x + w, bar_y + bar_h), outline=(60, 60, 60)) - fill_w = int(w * min(1.0, track["progress_pct"])) - if fill_w > 0: - draw.rectangle((x, bar_y, x + fill_w, bar_y + bar_h), fill=(60, 60, 60)) - times = f"{track['elapsed_text']} / {track['duration_text']}" - draw.text((centered_x(times, source_font), bar_y + bar_h + status_font.size * 0.4), times, font=source_font, fill=(110, 110, 110)) + draw.rectangle((x, bar_y, x + w, bar_y + bar_h), outline=(180, 180, 180)) + draw.text((centered_x(track["duration_text"], source_font), bar_y + bar_h + status_font.size * 0.4), track["duration_text"], font=source_font, fill=(110, 110, 110)) items.append((bar_gap + bar_h + status_font.size * 0.4 + source_font.size * 1.6, draw_progress)) elif track["duration"]: diff --git a/web/templates/settings_navidrome.html b/web/templates/settings_navidrome.html index 4eea6d1..c5503e3 100644 --- a/web/templates/settings_navidrome.html +++ b/web/templates/settings_navidrome.html @@ -25,7 +25,7 @@
- +