musikr: fix metadata drift

Largely a temporary compat measure to avoid playlist destruction, will
retire UIDs for a new system soon which should give me the ability to
rethink the spec.
This commit is contained in:
Alexander Capehart 2025-02-22 22:35:27 -07:00
parent b306456d46
commit 117678a066
No known key found for this signature in database
GPG key ID: 37DBE3621FE9AD47
4 changed files with 11 additions and 7 deletions

View file

@ -50,7 +50,7 @@ class AlbumImpl internal constructor(private val core: AlbumCore) : Album {
// I don't know if there is any situation where an artist will have two albums with
// the exact same name, but if there is, I would love to know.
update(preAlbum.rawName)
update(preAlbum.preArtists.map { it.rawName })
update(preAlbum.preArtists.mapNotNull { it.rawName })
}
override val name = preAlbum.name
override val releaseType = preAlbum.releaseType

View file

@ -51,7 +51,8 @@ internal data class PreSong(
val cover: Cover?,
val preAlbum: PreAlbum,
val preArtists: List<PreArtist>,
val preGenres: List<PreGenre>
val preGenres: List<PreGenre>,
val compatAlbumArtistNames: List<String>
) {
val uid =
musicBrainzId?.let { Music.UID.musicBrainz(Music.UID.Item.SONG, it) }
@ -66,8 +67,10 @@ internal data class PreSong(
update(track)
update(disc?.number)
update(preArtists.map { artist -> artist.rawName })
update(preAlbum.preArtists.map { artist -> artist.rawName })
update(preArtists.mapNotNull { artist -> artist.rawName })
// We have to encode the album artist names as-is w/o the interpreter's actions to
// maintain UID parity
update(compatAlbumArtistNames)
}
}

View file

@ -83,7 +83,8 @@ private class TagInterpreterImpl(private val interpretation: Interpretation) : T
preAlbum = preAlbum,
preArtists = rawArtists,
preGenres = rawGenres,
cover = song.cover)
cover = song.cover,
compatAlbumArtistNames = song.tags.albumArtistNames)
}
private fun makePreAlbum(

View file

@ -38,14 +38,14 @@ private data object TagParserImpl : TagParser {
replayGainTrackAdjustment = metadata.replayGainTrackAdjustment(),
replayGainAlbumAdjustment = metadata.replayGainAlbumAdjustment(),
musicBrainzId = metadata.musicBrainzId(),
name = metadata.name() ?: unlikelyToBeNull(file.path.name),
name = metadata.name() ?: unlikelyToBeNull(file.path.name).split('.').first(),
sortName = metadata.sortName(),
track = metadata.track(),
disc = metadata.disc(),
subtitle = metadata.subtitle(),
date = metadata.date(),
albumMusicBrainzId = metadata.albumMusicBrainzId(),
albumName = metadata.albumName(),
albumName = metadata.albumName() ?: file.path.directory.name,
albumSortName = metadata.albumSortName(),
// Compilation flag implies a compilation release type in the case that
// we don't have any other release types