#7070·beets

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

Author: apedroheringerCreated Oct 1, 2026Updated Oct 1, 2026
Labelslyrics

Problem

With synced: yes, the lyrics plugin sometimes stores plain lyrics even though LRCLIB has valid synced lyrics for the exact track. The log says Found lyrics, but the synced version is silently discarded.

Cause

LRCLyrics.verify_synced_lyrics (beetsplug/lyrics.py) only looks at the last line of the LRC text:

python
m := Lyrics.LINE_PARTS_PAT.match(lyrics.splitlines()[-1])

Some LRCLIB entries end with an extra blank line (...\r\n\r\n). Then splitlines()[-1] == "", LINE_PARTS_PAT (^(\[\d\d:\d\d\.\d{2,3}\]|) *(.*)$) matches the empty string with an empty timestamp group, if ts: is false, the method returns None, and the candidate falls back to plainLyrics.

Reproduction (beets 2.14.1, also unchanged on master)

LRCLIB record id 38757983 (Carly Rae Jepsen – "Blue Skies", duration 149 s):

python
from beetsplug.lyrics import LRCLyrics
lrc = "[00:17.23]I said \"I love you\" first\r\n[02:23.59]Feel it every time you are around\r\n\r\n"
print(LRCLyrics.verify_synced_lyrics(149.0, lrc))            # None  -> synced discarded
print(LRCLyrics.verify_synced_lyrics(149.0, lrc.rstrip()))   # accepted

In my library, applying rstrip() before the check turned 11 tracks of one album from plain into synced lyrics (all with LRCLIB records ending in a blank line). Entries ending in [mm:ss.xx] (timestamp with empty text) are not affected.

Suggested fix

Strip trailing whitespace before taking the last line, or use the last line that actually has a timestamp:

python
lines = lyrics.rstrip().splitlines()

A related, smaller point: the duration check has no tolerance (60 * mm + ss <= duration), while DURATION_DIFF_TOLERANCE exists in the class; a last timestamp slightly past the file length also discards valid synced lyrics.