mirror of
https://github.com/beetbox/beets.git
synced 2025-12-21 16:13:38 +01:00
Merge 948cdaccb1 into 2bd77b9895
This commit is contained in:
commit
9b7c55f797
2 changed files with 19 additions and 13 deletions
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue