musikr: add back mbids to backported uids
This commit is contained in:
parent
91b8b38732
commit
98299722bc
1 changed files with 26 additions and 21 deletions
|
@ -68,35 +68,40 @@ private class TagInterpreterImpl(private val interpretation: Interpretation) : T
|
||||||
val songNameOrFileWithoutExt =
|
val songNameOrFileWithoutExt =
|
||||||
song.tags.name ?: requireNotNull(song.file.path.name).split('.').first()
|
song.tags.name ?: requireNotNull(song.file.path.name).split('.').first()
|
||||||
val albumNameOrDir = song.tags.albumName ?: song.file.path.directory.name
|
val albumNameOrDir = song.tags.albumName ?: song.file.path.directory.name
|
||||||
|
|
||||||
|
val musicBrainzId = song.tags.musicBrainzId?.toUuidOrNull()
|
||||||
val v363uid =
|
val v363uid =
|
||||||
Music.UID.auxio(Music.UID.Item.SONG) {
|
musicBrainzId?.let { Music.UID.musicBrainz(Music.UID.Item.SONG, it) }
|
||||||
update(songNameOrFileWithoutExt)
|
?: Music.UID.auxio(Music.UID.Item.SONG) {
|
||||||
update(albumNameOrDir)
|
update(songNameOrFileWithoutExt)
|
||||||
update(song.tags.date)
|
update(albumNameOrDir)
|
||||||
|
update(song.tags.date)
|
||||||
|
|
||||||
update(song.tags.track)
|
update(song.tags.track)
|
||||||
update(song.tags.disc)
|
update(song.tags.disc)
|
||||||
|
|
||||||
update(song.tags.artistNames)
|
update(song.tags.artistNames)
|
||||||
update(song.tags.albumArtistNames)
|
update(song.tags.albumArtistNames)
|
||||||
}
|
}
|
||||||
|
|
||||||
// I was an idiot and accidentally changed the UID spec in v4.0.0, so we need to calculate
|
// I was an idiot and accidentally changed the UID spec in v4.0.0, so we need to calculate
|
||||||
// the broken UID too and maintain compat for that version.
|
// the broken UID too and maintain compat for that version.
|
||||||
val v400uid =
|
val v400uid =
|
||||||
Music.UID.auxio(Music.UID.Item.SONG) {
|
musicBrainzId?.let { Music.UID.musicBrainz(Music.UID.Item.SONG, it) }
|
||||||
update(songNameOrFile)
|
?: Music.UID.auxio(Music.UID.Item.SONG) {
|
||||||
update(song.tags.albumName)
|
update(songNameOrFile)
|
||||||
update(song.tags.date)
|
update(song.tags.albumName)
|
||||||
|
update(song.tags.date)
|
||||||
|
|
||||||
update(song.tags.track)
|
update(song.tags.track)
|
||||||
update(song.tags.disc)
|
update(song.tags.disc)
|
||||||
|
|
||||||
val artistNames = interpretation.separators.split(song.tags.artistNames)
|
val artistNames = interpretation.separators.split(song.tags.artistNames)
|
||||||
update(artistNames.ifEmpty { listOf(null) })
|
update(artistNames.ifEmpty { listOf(null) })
|
||||||
val albumArtistNames = interpretation.separators.split(song.tags.albumArtistNames)
|
val albumArtistNames =
|
||||||
update(albumArtistNames.ifEmpty { artistNames }.ifEmpty { listOf(null) })
|
interpretation.separators.split(song.tags.albumArtistNames)
|
||||||
}
|
update(albumArtistNames.ifEmpty { artistNames }.ifEmpty { listOf(null) })
|
||||||
|
}
|
||||||
|
|
||||||
return PreSong(
|
return PreSong(
|
||||||
v363Uid = v363uid,
|
v363Uid = v363uid,
|
||||||
|
@ -107,7 +112,7 @@ private class TagInterpreterImpl(private val interpretation: Interpretation) : T
|
||||||
format = Format.infer(song.file.mimeType, song.properties.mimeType),
|
format = Format.infer(song.file.mimeType, song.properties.mimeType),
|
||||||
modifiedMs = song.file.modifiedMs,
|
modifiedMs = song.file.modifiedMs,
|
||||||
addedMs = song.addedMs,
|
addedMs = song.addedMs,
|
||||||
musicBrainzId = song.tags.musicBrainzId?.toUuidOrNull(),
|
musicBrainzId = musicBrainzId,
|
||||||
name = interpretation.naming.name(songNameOrFileWithoutExt, song.tags.sortName),
|
name = interpretation.naming.name(songNameOrFileWithoutExt, song.tags.sortName),
|
||||||
rawName = songNameOrFileWithoutExt,
|
rawName = songNameOrFileWithoutExt,
|
||||||
track = song.tags.track,
|
track = song.tags.track,
|
||||||
|
|
Loading…
Reference in a new issue