fix(lyrics): Reject LRCLib records with no lyrics - #6906
Conversation
Some records on LRCLib have no lyrics, and aren't marked as instrumental, but are still returned (with a null text). beetbox#6864 fixed part of the issue (beetbox#6888), but didn't handle all of it.
There was a problem hiding this comment.
Pull request overview
grug see PR fix lyrics plugin. LRCLib sometimes give record with no plain and no synced lyrics, not marked instrumental, and that lead to None body and crash later. PR make plugin reject those empty records so search fall through to other candidates.
Changes:
- LRCLib candidate type now allow
plainLyricsbeNone. - LRCLib matching now require duration ok and have either instrumental flag or some lyrics text.
- Add regression test case + changelog note for bug 6888.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
beetsplug/lyrics.py |
Make LRCLib candidates treat “no lyrics text” as invalid match; adjust plain handling. |
beetsplug/_typing.py |
Update LRCLib API typing to allow `plainLyrics: str |
test/plugins/test_lyrics.py |
Add test case for LRCLib returning null lyrics fields. |
docs/changelog.rst |
Document bugfix for LRCLib null-lyrics matches. |
| if want_synced and self.synced: | ||
| return "\n".join(map(str.strip, self.synced.splitlines())) | ||
|
|
||
| return self.plain | ||
| return self.plain or "" |
There was a problem hiding this comment.
Addressed, falling back to synced, with timestamps trimmed
The ID returned by lrclib for this record has changed, breaking the test.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #6906 +/- ##
==========================================
+ Coverage 75.69% 75.84% +0.14%
==========================================
Files 163 163
Lines 21412 21418 +6
Branches 3384 3386 +2
==========================================
+ Hits 16208 16244 +36
+ Misses 4405 4369 -36
- Partials 799 805 +6
🚀 New features to boost your workflow:
|
When no plain lyrics are provided by synced lyrics are, fall back to synced without timestamps.
|
See #6900. Please check open PRs before submitting a PR. |
Feel free to add your own review ;) |
Description
Fixes #6888
Some records on LRCLib have no lyrics, and aren't marked as instrumental, but are still returned (with a null text). #6864 fixed part of the issue, but didn't handle all of it.
To Do
docs/to describe it.)docs/changelog.rstto the bottom of one of the lists near the top of the document.)