Parse repeating LRC lines #69

Merged
madmini merged 2 commits from feature/lrc-repeating-lines into main 2025-02-22 13:00:24 +03:00
madmini commented 2025-02-22 11:50:06 +03:00 (Migrated from github.com)

In LRC lyrics, allow repeating lines (with multiple timestamps):

[00:21.10][00:45.10]Repeating lyrics (e.g. chorus)

see https://en.wikipedia.org/wiki/LRC_(file_format)#File_format

Thank you for the great app!

In LRC lyrics, allow repeating lines (with multiple timestamps): ```lrc [00:21.10][00:45.10]Repeating lyrics (e.g. chorus) ``` see https://en.wikipedia.org/wiki/LRC_(file_format)#File_format Thank you for the great app!
TJYSunset (Migrated from github.com) reviewed 2025-02-22 13:05:20 +03:00
@ -28,9 +28,11 @@ data class Lyrics(val lines: List<Pair<Duration, String>>) {
}
}
TJYSunset (Migrated from github.com) commented 2025-02-22 13:05:20 +03:00

\d is not always equivalent to [0-9] in all contexts. While they're probably equal in Java 8 and receiving [٠٠:٠٠.٠٠] as an input would never happen in real world, it's still a good habit to not use suspicious things.

`\d` [is not](https://stackoverflow.com/questions/6479423/does-d-in-regex-mean-a-digit) always equivalent to `[0-9]` in all contexts. While they're probably equal in [Java 8](https://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html) and receiving `[٠٠:٠٠.٠٠]` as an input would never happen in real world, it's still a good habit to not use suspicious things.
madmini (Migrated from github.com) reviewed 2025-02-22 13:10:46 +03:00
@ -28,9 +28,11 @@ data class Lyrics(val lines: List<Pair<Duration, String>>) {
}
}
madmini (Migrated from github.com) commented 2025-02-22 13:10:45 +03:00

huh, i was not aware of that, definitely good to know 😅

huh, i was not aware of that, definitely good to know 😅
TJYSunset (Migrated from github.com) reviewed 2025-02-22 13:10:51 +03:00
@ -52,3 +47,1 @@
val text = it.groups["text"]!!.value.trim()
Pair(timestamp, text)
}
.flatMap { line ->
TJYSunset (Migrated from github.com) commented 2025-02-22 13:10:51 +03:00

Google is famous for arbitrarily deprecating things. Don't use their API whenever possible. Also I think this is an internal API they forgot to mark private - the docs mentioned "Do not use for collections that come from public APIs".

Google is famous for arbitrarily deprecating things. Don't use their API whenever possible. Also I think this is an internal API they forgot to mark private - the [docs](https://android.googlesource.com/platform/frameworks/support/+/refs/heads/androidx-main/compose/ui/ui-util/src/commonMain/kotlin/androidx/compose/ui/util/ListUtils.kt#522) mentioned "Do not use for collections that come from public APIs".
madmini (Migrated from github.com) reviewed 2025-02-22 13:17:10 +03:00
@ -52,3 +47,1 @@
val text = it.groups["text"]!!.value.trim()
Pair(timestamp, text)
}
.flatMap { line ->
madmini (Migrated from github.com) commented 2025-02-22 13:17:09 +03:00

ah, fair enough. i kind of misread that as "only use when you know that random access is fast" (and .lines() produces an arraylist). but i have to admit that regardless this would have been unnecessary and error prone optimization

ah, fair enough. i kind of misread that as "only use when you know that random access is fast" (and `.lines()` produces an arraylist). but i have to admit that regardless this would have been unnecessary and error prone optimization
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
novvux/Blissid!69
No description provided.