Repository navigation
lyrics: add --url option to fetch lyrics from a given URL - #7102
Open
jenish0908 wants to merge 1 commit into
Open
jenish0908 wants to merge 1 commit into
jenish0908 wants to merge 1 commit into
Conversation
Let each backend recognise URLs it can fetch lyrics from directly, so that a URL is parsed by the backend that owns it. Unrecognised URLs and queries matching more than one track are rejected. Fixes beetbox#6439
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #7102 +/- ##
==========================================
+ Coverage 79.26% 79.53% +0.26%
==========================================
Files 149 149
Lines 21216 21254 +38
Branches 3276 3283 +7
==========================================
+ Hits 16817 16904 +87
+ Misses 3585 3537 -48
+ Partials 814 813 -1
🚀 New features to boost your workflow:
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #6439.
Adds a
--urloption to thelyricscommand so lyrics can be fetched from a specific URL when the search picks the wrong match (e.g. several LRCLib records for one song):This picks up from #6548 and follows the review feedback there:
--urland is read viaself.config["url"]. The item is not modified up front;lyrics_urlis only stored once lyrics are actually fetched, like for any other match.URL_PAT/handles_url) and how to fetch them (fetch_url). The URL goes through that backend's normal parsing, so raw HTML is never stored as lyrics:lrclib:https://lrclib.net/api/get/<id>(the source URL beets already prints)genius,tekstowo,musixmatch: their lyrics pages, via the existingscrape()lrcmux: its configured/get?...URLgoogledoesn't claim any URLs since it scrapes arbitrary sites.The existing
fetch()methods of the scraping backends and lrcmux now delegate tofetch_url(), so search results and explicit URLs share one code path.A couple of behaviours worth flagging for review:
--urldoes not imply-f, so existing lyrics are kept unless-fis passed (consistent with the other options). Happy to change this if you'd prefer--urlto force.AI disclosure: I used Claude Code to help implement this and write the tests, following the approach I proposed in the issue. I reviewed and tested all the changes myself.
To Do