Skip to content

Commit

Permalink
refactor: Use a single field for lyrics
Browse files Browse the repository at this point in the history
This commit replaces the separate fields for SYLT and USLT lyrics with a single LYRICS field. This simplifies
 the code and makes it easier to work with lyrics.

Signed-off-by: Gabriel Fontán <[email protected]>
  • Loading branch information
BobbyESP committed Aug 6, 2024
1 parent 2360d4f commit 11d623e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -528,20 +528,12 @@ fun SongProperties(mutablePropertiesMap: SnapshotStateMap<String, String>) {
mutablePropertiesMap["COMMENT"] = comment
}
PreConfiguredOutlinedTextField(
value = mutablePropertiesMap["USLT"],
label = stringResource(id = R.string.lyrics) + (" (USLT)"),
value = mutablePropertiesMap["LYRICS"],
label = stringResource(id = R.string.lyrics),
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
) { lyrics ->
mutablePropertiesMap["LYRICS"] = lyrics
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ 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),
lyrics = this["LYRICS"]?.getOrNull(0),
)
}

Expand All @@ -57,7 +56,6 @@ 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),
"LYRICS" to this["LYRICS"]?.getOrNull(0),
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ data class AudioFileMetadata(
val conductor: String?,
val remixer: String?,
val comment: String?,
val sylt: String?,
val uslt: String?
val lyrics: String?
) {
companion object {
fun AudioFileMetadata.toPropertyMap(): PropertyMap {
Expand All @@ -42,8 +41,7 @@ data class AudioFileMetadata(
"PERFORMER" to performer.formatForField(),
"REMIXER" to remixer.formatForField(),
"COMMENT" to arrayOf(comment ?: ""),
"SYLT" to arrayOf(sylt ?: ""),
"USLT" to arrayOf(uslt ?: ""),
"LYRICS" to arrayOf(lyrics ?: "")
)
}

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

0 comments on commit 11d623e

Please sign in to comment.