mirror of
https://github.com/zarzet/SpotiFLAC-Mobile.git
synced 2026-09-30 13:19:44 +02:00
feat(lyrics): support multiple vocalists and aligned lyrics
This commit is contained in:
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:
|
||||
|
||||
|
Reference in new issue
Block a user