music: check compilation flag value

Only map compilation flags if the value is "1".
This commit is contained in:
Alexander Capehart 2023-03-19 13:18:24 -06:00
parent e50bc80a0b
commit 245896e4a7
No known key found for this signature in database
GPG key ID: 37DBE3621FE9AD47
2 changed files with 6 additions and 1 deletions

View file

@ -2,6 +2,9 @@
## dev ## dev
#### What's New
- Added support for `COMPILATION` and `ITUNESCOMPILATION` flags.
#### What's Improved #### What's Improved
- Accept `REPLAYGAIN_*` adjustment information on OPUS files alongside - Accept `REPLAYGAIN_*` adjustment information on OPUS files alongside
`R128_*` adjustments. `R128_*` adjustments.

View file

@ -159,7 +159,8 @@ private constructor(private val rawSong: RawSong, private val future: Future<Tra
textFrames["TCON"]?.let { rawSong.genreNames = it } textFrames["TCON"]?.let { rawSong.genreNames = it }
// Compilation Flag // Compilation Flag
(textFrames["TXXX:compilation"] ?: textFrames["TXXX:itunescompilation"])?.let { (textFrames["TCMP"] ?: textFrames["TXXX:compilation"] ?: textFrames["TXXX:itunescompilation"])?.let {
if (it.size != 1 || it[0] != "1") return@let
rawSong.albumArtistNames = rawSong.albumArtistNames.ifEmpty { COMPILATION_ALBUM_ARTISTS } rawSong.albumArtistNames = rawSong.albumArtistNames.ifEmpty { COMPILATION_ALBUM_ARTISTS }
rawSong.releaseTypes = rawSong.releaseTypes.ifEmpty { COMPILATION_RELEASE_TYPES } rawSong.releaseTypes = rawSong.releaseTypes.ifEmpty { COMPILATION_RELEASE_TYPES }
} }
@ -266,6 +267,7 @@ private constructor(private val rawSong: RawSong, private val future: Future<Tra
// Compilation Flag // Compilation Flag
(comments["compilation"] ?: comments["itunescompilation"])?.let { (comments["compilation"] ?: comments["itunescompilation"])?.let {
if (it.size != 1 || it[0] != "1") return@let
rawSong.albumArtistNames = rawSong.albumArtistNames.ifEmpty { COMPILATION_ALBUM_ARTISTS } rawSong.albumArtistNames = rawSong.albumArtistNames.ifEmpty { COMPILATION_ALBUM_ARTISTS }
rawSong.releaseTypes = rawSong.releaseTypes.ifEmpty { COMPILATION_RELEASE_TYPES } rawSong.releaseTypes = rawSong.releaseTypes.ifEmpty { COMPILATION_RELEASE_TYPES }
} }