feat(lyrics): support multiple vocalists and aligned lyrics

This commit is contained in:
zarzet committed 2026-09-26 14:50:05 +07:00
1 parent fc41572417
commit 95e0e3197d
13 files changed
+642 -66

No files matched your search

@@ -43,6 +43,7 @@ internal object NativeFinalizationPolicy {
private val lyricsInlineTimestampPattern = Regex(
"<\\d{1,3}:\\d{1,2}(?:[.:]\\d{1,3})?>",
)
private val lyricsVoicePrefixPattern = Regex("^v[1-9][0-9]*:", RegexOption.IGNORE_CASE)
fun hasUsableLyricsContent(raw: String?): Boolean {
val lyrics = raw.orEmpty().trim()
@@ -63,12 +64,7 @@ internal object NativeFinalizationPolicy {
cleaned = lyricsTimestampPattern.replaceFirst(cleaned, "").trim()
}
cleaned = lyricsInlineTimestampPattern.replace(cleaned, "").trim()
if (
cleaned.startsWith("v1:", ignoreCase = true) ||
cleaned.startsWith("v2:", ignoreCase = true)
) {
cleaned = cleaned.drop(3).trim()
}
cleaned = lyricsVoicePrefixPattern.replaceFirst(cleaned, "").trim()
if (cleaned.isNotEmpty()) return true
}
return false
@@ -1,4 +1,4 @@
# Shared Dart/Go/Kotlin lyric-usability cases.
# Shared Dart/Rust/Kotlin lyric-usability cases.
# Columns: name<TAB>expected boolean<TAB>lyrics. Decode literal \n, \r, \t in lyrics.
empty false
whitespace false \t\r\n
@@ -8,6 +8,8 @@ instrumental true [Instrumental:TRUE]
timestamps_only false [00:01.00]\n<00:01.10>
multiple_timestamps false [00:01.00][01:02:500]
speaker_only false v1:\n V2:
multiple_singers_only false [00:01.00]v3:\n[00:02.00]<00:02.00>V12:
third_singer_text true [00:01.00]v3:Third singer
inline_before_spaced_speaker false [00:00.00]<00:00.01> v1:
inline_before_tabbed_speaker false [00:00.00]<00:00.01>\tV2:\t
multiple_inline_speaker false [00:00.00]<00:00.01> <00:00.02> v2:
1 # Shared Dart/Go/Kotlin lyric-usability cases. # Shared Dart/Rust/Kotlin lyric-usability cases.
2 # Columns: name<TAB>expected boolean<TAB>lyrics. Decode literal \n, \r, \t in lyrics.
3 empty
4 whitespace
8 timestamps_only
9 multiple_timestamps
10 speaker_only
11 multiple_singers_only
12 third_singer_text
13 inline_before_spaced_speaker
14 inline_before_tabbed_speaker
15 multiple_inline_speaker