player: log last DLNA URL to /tmp/dlna_last_url.txt on play(); tests: auto-load it in diagnostic script

This commit is contained in:
Matteo Benedetto
2026-03-23 23:50:11 +01:00
parent 79a1c9a78c
commit 6715f4b227
2 changed files with 16 additions and 1 deletions
@@ -299,6 +299,11 @@ class GStreamerBackend(PlayerBackend):
self._set_playing(True, notify=False) self._set_playing(True, notify=False)
self._event_callback("buffering", 100) self._event_callback("buffering", 100)
log.info("Starting SDL-rendered GStreamer playback: %s", url) log.info("Starting SDL-rendered GStreamer playback: %s", url)
try:
with open("/tmp/dlna_last_url.txt", "w") as _f:
_f.write(url + "\n")
except OSError:
pass
def stop(self) -> None: def stop(self) -> None:
with self._lock: with self._lock:
+11 -1
View File
@@ -218,11 +218,21 @@ if not audio_ok:
test_url = sys.argv[1] if len(sys.argv) > 1 else None test_url = sys.argv[1] if len(sys.argv) > 1 else None
if not test_url:
try:
with open("/tmp/dlna_last_url.txt") as _f:
test_url = _f.read().strip() or None
if test_url:
print(f"\n [auto] Loaded last DLNA URL from /tmp/dlna_last_url.txt")
except FileNotFoundError:
pass
_section("6. Live URL / file playback") _section("6. Live URL / file playback")
if not test_url: if not test_url:
_warn("No URL provided — skipping live playback test.") _warn("No URL provided — skipping live playback test.")
print(" Pass a media URL or path as the first argument to test real decode.") print(" Pass a media URL or path as the first argument, or start the app and")
print(" play something; the URL will be saved to /tmp/dlna_last_url.txt.")
else: else:
print(f" URL: {test_url}") print(f" URL: {test_url}")
live_frames = 0 live_frames = 0