musikr: backport breaking uid change
v401 UIDs once again drifted because of the broken extensions.
This commit is contained in:
parent
0bbba2efaf
commit
403f93b6df
5 changed files with 24 additions and 2 deletions
|
@ -144,6 +144,8 @@ private class MusicGraphBuilderImpl : MusicGraph.Builder {
|
|||
it.pointerMap[v363Pointer]?.forEach { index -> it.songVertices[index] = vertex }
|
||||
val v400Pointer = SongPointer.UID(entry.value.preSong.v400Uid)
|
||||
it.pointerMap[v400Pointer]?.forEach { index -> it.songVertices[index] = vertex }
|
||||
val v401Pointer = SongPointer.UID(entry.value.preSong.v401Uid)
|
||||
it.pointerMap[v401Pointer]?.forEach { index -> it.songVertices[index] = vertex }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -38,6 +38,7 @@ internal data class LibraryImpl(
|
|||
) : MutableLibrary {
|
||||
private val songUidMap = songs.associateBy { it.uid }
|
||||
private val v400SongUidMap = songs.associateBy { it.v400Uid }
|
||||
private val v401SongUidMap = songs.associateBy { it.v401Uid }
|
||||
private val albumUidMap = albums.associateBy { it.uid }
|
||||
private val artistUidMap = artists.associateBy { it.uid }
|
||||
private val genreUidMap = genres.associateBy { it.uid }
|
||||
|
@ -46,7 +47,8 @@ internal data class LibraryImpl(
|
|||
override fun empty() = songs.isEmpty()
|
||||
|
||||
// Compat hack. See TagInterpreter for why this needs to be done
|
||||
override fun findSong(uid: Music.UID) = songUidMap[uid] ?: v400SongUidMap[uid]
|
||||
override fun findSong(uid: Music.UID) =
|
||||
songUidMap[uid] ?: v400SongUidMap[uid] ?: v401SongUidMap[uid]
|
||||
|
||||
override fun findSongByPath(path: Path) = songs.find { it.path == path }
|
||||
|
||||
|
|
|
@ -46,6 +46,8 @@ internal class SongImpl(private val handle: SongCore) : Song {
|
|||
|
||||
val v400Uid = preSong.v400Uid
|
||||
|
||||
val v401Uid = preSong.v401Uid
|
||||
|
||||
override val name = preSong.name
|
||||
override val track = preSong.track
|
||||
override val disc = preSong.disc
|
||||
|
|
|
@ -33,6 +33,7 @@ import org.oxycblt.musikr.tag.ReplayGainAdjustment
|
|||
internal data class PreSong(
|
||||
val v363Uid: Music.UID,
|
||||
val v400Uid: Music.UID,
|
||||
val v401Uid: Music.UID,
|
||||
val musicBrainzId: UUID?,
|
||||
val name: Name.Known,
|
||||
val rawName: String,
|
||||
|
|
|
@ -76,7 +76,7 @@ private class TagInterpreterImpl(private val interpretation: Interpretation) : T
|
|||
val v363uid =
|
||||
musicBrainzId?.let { Music.UID.musicBrainz(Music.UID.Item.SONG, it) }
|
||||
?: Music.UID.auxio(Music.UID.Item.SONG) {
|
||||
update(songNameOrFileWithoutExt)
|
||||
update(songNameOrFileWithoutExtCorrect)
|
||||
update(albumNameOrDir)
|
||||
update(song.tags.date)
|
||||
|
||||
|
@ -106,9 +106,24 @@ private class TagInterpreterImpl(private val interpretation: Interpretation) : T
|
|||
update(albumArtistNames.ifEmpty { artistNames }.ifEmpty { listOf(null) })
|
||||
}
|
||||
|
||||
val v401uid =
|
||||
musicBrainzId?.let { Music.UID.musicBrainz(Music.UID.Item.SONG, it) }
|
||||
?: Music.UID.auxio(Music.UID.Item.SONG) {
|
||||
update(songNameOrFileWithoutExt)
|
||||
update(albumNameOrDir)
|
||||
update(song.tags.date)
|
||||
|
||||
update(song.tags.track)
|
||||
update(song.tags.disc)
|
||||
|
||||
update(song.tags.artistNames)
|
||||
update(song.tags.albumArtistNames)
|
||||
}
|
||||
|
||||
return PreSong(
|
||||
v363Uid = v363uid,
|
||||
v400Uid = v400uid,
|
||||
v401Uid = v401uid,
|
||||
uri = uri,
|
||||
path = song.file.path,
|
||||
size = song.file.size,
|
||||
|
|
Loading…
Reference in a new issue