This commit is contained in:
jasling920 2025-12-05 08:20:23 +00:00 committed by GitHub
commit 9b7c55f797
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 19 additions and 13 deletions

View file

@ -138,21 +138,24 @@ class SubsonicUpdate(BeetsPlugin):
params=payload,
timeout=10,
)
json = response.json()
if (
response.status_code == 200
and json["subsonic-response"]["status"] == "ok"
):
count = json["subsonic-response"]["scanStatus"]["count"]
self._log.info("Updating Subsonic; scanning {} tracks", count)
elif (
response.status_code == 200
and json["subsonic-response"]["status"] == "failed"
):
response.raise_for_status()
try:
json = response.json()
except ValueError:
self._log.error(
"Error: {[subsonic-response][error][message]}", json
"Invalid JSON from Subsonic: {}", response.text[:200]
)
return
if not (resp := json.get("subsonic-response")):
self._log.error("Missing 'subsonic-response' field: {}", json)
return
status = resp.get("status")
if status == "ok":
count = resp.get("scanStatus", {}).get("count", 0)
self._log.info("Updating Subsonic; scanning {} tracks", count)
elif status == "failed":
msg = resp.get("error", {}).get("message", "Unknown error")
self._log.error("Error: {}", msg)
else:
self._log.error("Error: {}", json)
except Exception as error:

View file

@ -34,6 +34,9 @@ New features:
Bug fixes:
- :doc:`plugins/subsonicupdate`: Improve error messages when the Subsonic server
is unavailable or returns invalid JSON. Previously, failures were cryptic
(for instance, "Expecting value: line 1 column 1 (char 0)"). :bug:`5635`
- :doc:`plugins/inline`: Fix recursion error when an inline field definition
shadows a built-in item field (e.g., redefining ``track_no``). Inline
expressions now skip self-references during evaluation to avoid infinite