Repository navigation
nightly-e333038d-ls23
Pre-releaseCI
LinuxServer changes
Full Changelog: nightly-718dc3ae-ls22...nightly-e333038d-ls23
Upstream changes
Source: beetbox/beets@e333038
lyrics: warn clearly when Google refuses the search request (#7148)
Description
Fixes #6761.
Google has closed the Custom Search JSON API to new customers, and
existing customers must move to another solution by January 1, 2027 (as
written in the issue). When Google refuses the request, the google
source of the lyrics plugin only logged a generic Request error: 403 Client Error ..., which is hard to understand.
I kept this change small on purpose. I did not choose a replacement
service, because I think this is a decision for the maintainers.
What I changed
- In
beetsplug/lyrics.py, theGooglebackend now catches an HTTP 400
or 403 error and logs a clear message: checkgoogle_API_keyand
google_engine_ID, the API is closed to new customers and will be
discontinued on January 1, 2027, and the other sources can be used
instead. The search then returns no result, so the plugin goes on with
the next source. Other errors are handled as before. - In
docs/plugins/lyrics.rst, I added a warning in the "Activate
Google Custom Search" section. - I added an entry to the changelog.
Tests
I added test_search_refused_by_google in
test/plugins/test_lyrics.py. It mocks the Google response with status
400 and 403 and checks that the search returns nothing and the clear
message is logged. The test fails without the change and passes with it.
I ran poe format, poe lint and poe test test/plugins/test_lyrics.py on my computer (131 passed, 18 skipped).
Notes
- I could not test with a real Google account. I assumed that Google
answers with 400 (invalid key) or 403 (no access to the API). If Google
uses another status for a closed API, the status codes in the code
should be changed.
AI usage
I used Claude to help me with this contribution. I ran the tests and the
linter myself .