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,
|
params=payload,
|
||||||
timeout=10,
|
timeout=10,
|
||||||
)
|
)
|
||||||
json = response.json()
|
response.raise_for_status()
|
||||||
|
try:
|
||||||
if (
|
json = response.json()
|
||||||
response.status_code == 200
|
except ValueError:
|
||||||
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"
|
|
||||||
):
|
|
||||||
self._log.error(
|
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:
|
else:
|
||||||
self._log.error("Error: {}", json)
|
self._log.error("Error: {}", json)
|
||||||
except Exception as error:
|
except Exception as error:
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,9 @@ New features:
|
||||||
|
|
||||||
Bug fixes:
|
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
|
- :doc:`plugins/inline`: Fix recursion error when an inline field definition
|
||||||
shadows a built-in item field (e.g., redefining ``track_no``). Inline
|
shadows a built-in item field (e.g., redefining ``track_no``). Inline
|
||||||
expressions now skip self-references during evaluation to avoid infinite
|
expressions now skip self-references during evaluation to avoid infinite
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue