Skip to content

Commit

Permalink
feat: Added lyrics editing to Metadata editor
Browse files Browse the repository at this point in the history
Added fields for editing synchronized lyrics (SYLT) and unsynchronized lyrics (USLT) to the Metadata editor
 page.
This allows users to view and modify lyrics embedded in audio files.

Signed-off-by: Gabriel Fontán <[email protected]>
  • Loading branch information
BobbyESP committed Aug 6, 2024
1 parent da765f3 commit 2360d4f
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,22 @@ fun SongProperties(mutablePropertiesMap: SnapshotStateMap<String, String>) {
) { comment ->
mutablePropertiesMap["COMMENT"] = comment
}
PreConfiguredOutlinedTextField(
value = mutablePropertiesMap["USLT"],
label = stringResource(id = R.string.lyrics) + (" (USLT)"),
modifier = Modifier.fillMaxWidth(),
maxLines = 20
) { uslt_lyrics ->
mutablePropertiesMap["USLT"] = uslt_lyrics
}
PreConfiguredOutlinedTextField(
value = mutablePropertiesMap["SYLT"],
label = stringResource(id = R.string.lyrics) + (" (SYLT)"),
modifier = Modifier.fillMaxWidth(),
maxLines = 20
) { sylt_lyrics ->
mutablePropertiesMap["SYLT"] = sylt_lyrics
}
}
}
}
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,5 @@
<string name="general_description">Some main settings of the app</string>
<string name="marquee_text">Marquee text</string>
<string name="marquee_text_description">The text that overflows the limits of the screen has an animation to show its entire content (this may lag the app).</string>
<string name="lyrics">Lyrics</string>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ fun PropertyMap.toAudioFileMetadata(separator: String = ", "): AudioFileMetadata
conductor = this["CONDUCTOR"]?.joinOrNullToString(separator),
remixer = this["REMIXER"]?.joinOrNullToString(separator),
comment = this["COMMENT"]?.getOrNull(0),
sylt = this["SYLT"]?.getOrNull(0),
uslt = this["USLT"]?.getOrNull(0),
)
}

Expand All @@ -55,5 +57,7 @@ fun PropertyMap.toModifiableMap(separator: String = ", "): MutableMap<String, St
"CONDUCTOR" to this["CONDUCTOR"]?.joinOrNullToString(separator),
"REMIXER" to this["REMIXER"]?.joinOrNullToString(separator),
"COMMENT" to this["COMMENT"]?.getOrNull(0),
"SYLT" to this["SYLT"]?.getOrNull(0),
"USLT" to this["USLT"]?.getOrNull(0),
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ data class AudioFileMetadata(
val conductor: String?,
val remixer: String?,
val comment: String?,
val sylt: String?,
val uslt: String?
) {
companion object {
fun AudioFileMetadata.toPropertyMap(): PropertyMap {
Expand All @@ -40,6 +42,8 @@ data class AudioFileMetadata(
"PERFORMER" to performer.formatForField(),
"REMIXER" to remixer.formatForField(),
"COMMENT" to arrayOf(comment ?: ""),
"SYLT" to arrayOf(sylt ?: ""),
"USLT" to arrayOf(uslt ?: ""),
)
}

Expand All @@ -59,6 +63,8 @@ data class AudioFileMetadata(
conductor = this["CONDUCTOR"],
remixer = this["REMIXER"],
comment = this["COMMENT"],
sylt = this["SYLT"],
uslt = this["USLT"],
)
}
}
Expand Down

0 comments on commit 2360d4f

Please sign in to comment.