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:
parent
7a90e7eef1
commit
4421d6cf36
1 changed files with 5 additions and 8 deletions
|
@ -150,26 +150,26 @@ class SongImpl(
|
|||
val artistSortNames = separators.split(rawSong.artistSortNames)
|
||||
val rawIndividualArtists =
|
||||
artistNames
|
||||
.mapIndexedTo(mutableSetOf()) { i, name ->
|
||||
.mapIndexed { i, name ->
|
||||
RawArtist(
|
||||
artistMusicBrainzIds.getOrNull(i)?.toUuidOrNull(),
|
||||
name,
|
||||
artistSortNames.getOrNull(i))
|
||||
}
|
||||
.toList()
|
||||
.distinctBy { it.key }
|
||||
|
||||
val albumArtistMusicBrainzIds = separators.split(rawSong.albumArtistMusicBrainzIds)
|
||||
val albumArtistNames = separators.split(rawSong.albumArtistNames)
|
||||
val albumArtistSortNames = separators.split(rawSong.albumArtistSortNames)
|
||||
val rawAlbumArtists =
|
||||
albumArtistNames
|
||||
.mapIndexedTo(mutableSetOf()) { i, name ->
|
||||
.mapIndexed { i, name ->
|
||||
RawArtist(
|
||||
albumArtistMusicBrainzIds.getOrNull(i)?.toUuidOrNull(),
|
||||
name,
|
||||
albumArtistSortNames.getOrNull(i))
|
||||
}
|
||||
.toList()
|
||||
.distinctBy { it.key }
|
||||
|
||||
rawAlbum =
|
||||
RawAlbum(
|
||||
|
@ -195,10 +195,7 @@ class SongImpl(
|
|||
val genreNames =
|
||||
(rawSong.genreNames.parseId3GenreNames() ?: separators.split(rawSong.genreNames))
|
||||
rawGenres =
|
||||
genreNames
|
||||
.mapTo(mutableSetOf()) { RawGenre(it) }
|
||||
.toList()
|
||||
.ifEmpty { listOf(RawGenre()) }
|
||||
genreNames.map { RawGenre(it) }.distinctBy { it.key }.ifEmpty { listOf(RawGenre()) }
|
||||
|
||||
hashCode = 31 * hashCode + rawSong.hashCode()
|
||||
hashCode = 31 * hashCode + nameFactory.hashCode()
|
||||
|
|
Loading…
Reference in a new issue