music: deduplicate by case
At some point, the switch to keying raw music information broke my mitigation for duplicate tags that use similar cases. This then crashed the music loader in certain cases. Fix it by making the check use raw music keys. Resolves #614
This commit is contained in:
@@ -150,26 +150,26 @@ class SongImpl(
|
|||||||
val artistSortNames = separators.split(rawSong.artistSortNames)
|
val artistSortNames = separators.split(rawSong.artistSortNames)
|
||||||
val rawIndividualArtists =
|
val rawIndividualArtists =
|
||||||
artistNames
|
artistNames
|
||||||
.mapIndexedTo(mutableSetOf()) { i, name ->
|
.mapIndexed { i, name ->
|
||||||
RawArtist(
|
RawArtist(
|
||||||
artistMusicBrainzIds.getOrNull(i)?.toUuidOrNull(),
|
artistMusicBrainzIds.getOrNull(i)?.toUuidOrNull(),
|
||||||
name,
|
name,
|
||||||
artistSortNames.getOrNull(i))
|
artistSortNames.getOrNull(i))
|
||||||
}
|
}
|
||||||
.toList()
|
.distinctBy { it.key }
|
||||||
|
|
||||||
val albumArtistMusicBrainzIds = separators.split(rawSong.albumArtistMusicBrainzIds)
|
val albumArtistMusicBrainzIds = separators.split(rawSong.albumArtistMusicBrainzIds)
|
||||||
val albumArtistNames = separators.split(rawSong.albumArtistNames)
|
val albumArtistNames = separators.split(rawSong.albumArtistNames)
|
||||||
val albumArtistSortNames = separators.split(rawSong.albumArtistSortNames)
|
val albumArtistSortNames = separators.split(rawSong.albumArtistSortNames)
|
||||||
val rawAlbumArtists =
|
val rawAlbumArtists =
|
||||||
albumArtistNames
|
albumArtistNames
|
||||||
.mapIndexedTo(mutableSetOf()) { i, name ->
|
.mapIndexed { i, name ->
|
||||||
RawArtist(
|
RawArtist(
|
||||||
albumArtistMusicBrainzIds.getOrNull(i)?.toUuidOrNull(),
|
albumArtistMusicBrainzIds.getOrNull(i)?.toUuidOrNull(),
|
||||||
name,
|
name,
|
||||||
albumArtistSortNames.getOrNull(i))
|
albumArtistSortNames.getOrNull(i))
|
||||||
}
|
}
|
||||||
.toList()
|
.distinctBy { it.key }
|
||||||
|
|
||||||
rawAlbum =
|
rawAlbum =
|
||||||
RawAlbum(
|
RawAlbum(
|
||||||
@@ -195,10 +195,7 @@ class SongImpl(
|
|||||||
val genreNames =
|
val genreNames =
|
||||||
(rawSong.genreNames.parseId3GenreNames() ?: separators.split(rawSong.genreNames))
|
(rawSong.genreNames.parseId3GenreNames() ?: separators.split(rawSong.genreNames))
|
||||||
rawGenres =
|
rawGenres =
|
||||||
genreNames
|
genreNames.map { RawGenre(it) }.distinctBy { it.key }.ifEmpty { listOf(RawGenre()) }
|
||||||
.mapTo(mutableSetOf()) { RawGenre(it) }
|
|
||||||
.toList()
|
|
||||||
.ifEmpty { listOf(RawGenre()) }
|
|
||||||
|
|
||||||
hashCode = 31 * hashCode + rawSong.hashCode()
|
hashCode = 31 * hashCode + rawSong.hashCode()
|
||||||
hashCode = 31 * hashCode + nameFactory.hashCode()
|
hashCode = 31 * hashCode + nameFactory.hashCode()
|
||||||
|
|||||||
Reference in New Issue
Block a user