fix(server): use .get() for title/artist in perform_url_fetch result

Defensive access guards against download_single returning ok=True
without title/artist keys, avoiding a KeyError in the job worker.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-09 00:00:45 -07:00
parent 0f7ddd7697
commit 90b9a01872

View File

@@ -94,5 +94,5 @@ def perform_url_fetch(url: str, quality: str, root: str) -> dict:
info = mf.download_single(url, root, quality, False) info = mf.download_single(url, root, quality, False)
if not info.get("ok"): if not info.get("ok"):
raise RuntimeError("Download failed.") raise RuntimeError("Download failed.")
return {"kind": "track", "title": info["title"], "artist": info["artist"], return {"kind": "track", "title": info.get("title", ""), "artist": info.get("artist", ""),
"ok": 1, "total": 1, "path": None, "lidarr_album_id": None} "ok": 1, "total": 1, "path": None, "lidarr_album_id": None}