aboutsummaryrefslogtreecommitdiffstats
path: root/yt_radio.py
diff options
context:
space:
mode:
authorPinapelz <yukais@pinapelz.com>2026-02-18 01:57:06 -0800
committerPinapelz <yukais@pinapelz.com>2026-02-18 01:57:06 -0800
commitcfb04f73a2fb4a3290cb81bc6b710d93f94d6c5d (patch)
treeb99e768407d8381a555db1c92f5202c490b48a61 /yt_radio.py
parent582a8dca61281f6b4c7885c3f0a24d762a19c1d6 (diff)
README: its more like 200 lines now after some qol
Diffstat (limited to 'yt_radio.py')
-rw-r--r--yt_radio.py4
1 files changed, 0 insertions, 4 deletions
diff --git a/yt_radio.py b/yt_radio.py
index aa6b896..d06516f 100644
--- a/yt_radio.py
+++ b/yt_radio.py
@@ -23,7 +23,6 @@ if not PLAYLIST_URL:
raise RuntimeError("Please set PLAYLIST_URL environment variable")
METADATA = {}
-# Simple thread-safe cache for yt-dlp JSON outputs
_CACHE_LOCK = threading.Lock()
try:
if os.path.exists(YTDLP_CACHE_FILE):
@@ -84,7 +83,6 @@ def fetch_metadata(index, url):
cached = _CACHE.get(url)
if cached:
try:
- # cached may be the full yt-dlp JSON dict
data = cached
METADATA[index] = {
"title": data.get("title", f"Track {index+1}"),
@@ -112,7 +110,6 @@ def fetch_metadata(index, url):
"artist": data.get("uploader", "Unknown"),
"duration": data.get("duration", -1)
}
- # store full json in cache
with _CACHE_LOCK:
_CACHE[url] = data
try:
@@ -121,7 +118,6 @@ def fetch_metadata(index, url):
logger.exception("Failed to persist cache after fetching %s", url)
logger.debug("Fetched metadata for index %s: %s", index, METADATA[index])
except Exception:
- # Fallback defaults
METADATA[index] = {
"title": f"Track {index+1}",
"artist": "Unknown",
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage