feat: add bg support for lrc (extended)

This commit is contained in:
Zhe Fang
2026-01-05 19:43:41 -05:00
parent 7ddfd1118b
commit c1ee7a6779

View File

@@ -40,11 +40,24 @@ namespace BetterLyrics.WinUI3.Parsers.LyricsParser
startIndex += text.Length; startIndex += text.Length;
} }
if (syllables.Count > 1) int lineEndMs = 0;
if (syllables.Count > 0)
{
var lastSyllable = syllables[syllables.Count - 1];
if (string.IsNullOrWhiteSpace(lastSyllable.Text))
{
lineEndMs = lastSyllable.StartMs;
syllables.RemoveAt(syllables.Count - 1);
}
}
if (syllables.Count > 0)
{ {
lrcLines.Add(new LyricsLine lrcLines.Add(new LyricsLine
{ {
StartMs = syllables[0].StartMs, StartMs = syllables[0].StartMs,
EndMs = lineEndMs,
OriginalText = string.Concat(syllables.Select(s => s.Text)), OriginalText = string.Concat(syllables.Select(s => s.Text)),
LyricsSyllables = syllables LyricsSyllables = syllables
}); });