Skip to content

fix(lyrics): Reject LRCLib records with no lyrics - #6906

Closed
Kernald wants to merge 3 commits into
beetbox:masterfrom
Kernald:fix-lrclib-empty-lyrics
Closed

fix(lyrics): Reject LRCLib records with no lyrics#6906
Kernald wants to merge 3 commits into
beetbox:masterfrom
Kernald:fix-lrclib-empty-lyrics

Conversation

@Kernald

@Kernald Kernald commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

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

  • Documentation. (If you've added a new command-line flag, for example, find the appropriate page under docs/ to describe it.)
  • Changelog. (Add an entry to docs/changelog.rst to the bottom of one of the lists near the top of the document.)
  • Tests. (Very much encouraged but not strictly required.)

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.
@Kernald
Kernald requested a review from a team as a code owner August 5, 2026 03:12
Copilot AI lite review requested due to automatic review settings August 5, 2026 03:12
@github-actions github-actions Bot added the lyrics lyrics plugin label Aug 5, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 plainLyrics be None.
  • 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.

Comment thread beetsplug/lyrics.py Outdated
Comment on lines +340 to +343
if want_synced and self.synced:
return "\n".join(map(str.strip, self.synced.splitlines()))

return self.plain
return self.plain or ""

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed, falling back to synced, with timestamps trimmed

The ID returned by lrclib for this record has changed, breaking the
test.
@codecov

codecov Bot commented Aug 5, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.84%. Comparing base (74c2d98) to head (8c9d453).
✅ All tests successful. No failed tests found.

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     
Files with missing lines Coverage Δ
beetsplug/lyrics.py 90.09% <100.00%> (+6.04%) ⬆️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

When no plain lyrics are provided by synced lyrics are, fall back to
synced without timestamps.
@snejus

snejus commented Aug 5, 2026

Copy link
Copy Markdown
Member

See #6900. Please check open PRs before submitting a PR.

@snejus snejus closed this Aug 5, 2026
@Kernald

Kernald commented Aug 5, 2026

Copy link
Copy Markdown
Contributor Author

My bad, I had checked a few days ago following #6888 being marked as closed but not being actually fixed, and didn't check then - is there any way I can help pushing #6900 along?

@semohr

semohr commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

is there any way I can help pushing #6900 along?

Feel free to add your own review ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lyrics lyrics plugin

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Beets import crash with lyrics plugin for file w/o lyrics

4 participants