Skip to content

lyrics: keep synced LRCLib lyrics that end with a blank line - #7095

Merged
snejus merged 7 commits into
beetbox:masterfrom
Muhtasim-Munif-Fahim:lyrics-synced-trailing-blank-line
Nov 15, 2026
Merged

snejus merged 7 commits into
beetbox:masterfrom
Muhtasim-Munif-Fahim:lyrics-synced-trailing-blank-line

Conversation

@Muhtasim-Munif-Fahim

Copy link
Copy Markdown
Contributor

Description

Fixes #7070.

With synced: yes, LRCLib candidates whose syncedLyrics end with a blank line (...\r\n\r\n) were silently stored as plain lyrics. LRCLyrics.verify_synced_lyrics matched LINE_PARTS_PAT against lyrics.splitlines()[-1], which is "" for those entries, so the timestamp group was empty and the synced lyrics were rejected.

The check now uses the last line with text (lyrics.rstrip().splitlines()), with a guard so whitespace-only input is still rejected rather than raising IndexError. The returned lyrics are unchanged.

I left the duration tolerance point from the issue alone, since it changes which candidates are accepted and is probably worth a separate discussion.

To Do

  • Documentation (bug fix, no docs change needed)
  • Changelog (entry under Bug fixes)
  • Tests: new TestLRCLibLyrics.test_fetch_lyrics case "synced with trailing blank line" (fails without the fix, passes with it)

Tests run

  • pytest test/plugins/test_lyrics.py → 130 passed, 18 skipped
  • ruff check / ruff format --check on the changed files

AI assistance was used to help find the cause, write the patch, and run tests; I reviewed the change and can answer questions about it.

verify_synced_lyrics only looked at the last line of the LRC text. When an
LRCLib entry ends with a blank line, that line has no timestamp, so the
synced lyrics were discarded in favour of the plain ones. Check the last
line with text instead.

Fixes beetbox#7070
@Muhtasim-Munif-Fahim
Muhtasim-Munif-Fahim requested a review from a team as a code owner October 11, 2026 02:31
Copilot AI balanced review requested due to automatic review settings October 11, 2026 02:31

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions github-actions Bot added the lyrics lyrics plugin label Oct 11, 2026
@codecov

codecov Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.01%. Comparing base (029ac6f) to head (43e4532).
⚠️ Report is 18 commits behind head on master.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7095      +/-   ##
==========================================
+ Coverage   80.83%   81.01%   +0.17%     
==========================================
  Files         150      150              
  Lines       21214    21216       +2     
  Branches     3241     3242       +1     
==========================================
+ Hits        17149    17188      +39     
+ Misses       3249     3213      -36     
+ Partials      816      815       -1     
Files with missing lines Coverage Δ
beetsplug/lyrics.py 89.70% <100.00%> (+6.48%) ⬆️

... and 4 files 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.

@snejus
snejus enabled auto-merge November 1, 2026 12:52
@snejus
snejus added this pull request to the merge queue Nov 15, 2026
Merged via the queue into beetbox:master with commit ee6e08a Nov 15, 2026
19 checks passed
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.

lyrics: synced LRCLIB lyrics silently discarded when the LRC ends with a blank line

3 participants