Skip to content

Commit

Permalink
Support for multi person word-by-word lyrics
Browse files Browse the repository at this point in the history
  • Loading branch information
Lambada10 committed Sep 20, 2024
1 parent 75d0f7e commit 775a5c3
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,33 @@ class AppleAPI {
for (line in lines) {
syncedLyrics.append("[${line.timestamp.toLrcTimestamp()}]")

syncedLyrics.append(
if (line.oppositeTurn) "v2: " else "v1: "
)

for (syllable in line.text) {
syncedLyrics.append("<${syllable.timestamp!!.toLrcTimestamp()}>${syllable.text}")
if (!syllable.part) {
syncedLyrics.append(" ")
}
}

syncedLyrics.append("<${line.endtime.toLrcTimestamp()}>\n")
if (line.background) {
syncedLyrics.append("<${line.text.last().endtime?.toLrcTimestamp()}>\n")

syncedLyrics.append("[bg: ")

for (syllable in line.backgroundText) {
syncedLyrics.append("<${syllable.timestamp!!.toLrcTimestamp()}>${syllable.text}")
if (!syllable.part) {
syncedLyrics.append(" ")
}
}

syncedLyrics.append("<${line.endtime.toLrcTimestamp()}>]\n")
} else {
syncedLyrics.append("<${line.endtime.toLrcTimestamp()}>\n")
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,16 @@ data class AppleLyricsResponse(
data class AppleLyrics(
val text: List<AppleLyricsLineDetails>,
val timestamp: Int,
val oppositeTurn: Boolean,
val background: Boolean,
val backgroundText: List<AppleLyricsLineDetails>,
val endtime: Int
)

@Serializable
data class AppleLyricsLineDetails(
val text: String,
val part: Boolean,
val timestamp: Int?
val timestamp: Int?,
val endtime: Int?
)

0 comments on commit 775a5c3

Please sign in to comment.