musikr: compute uid on presong creation
This commit is contained in:
parent
7768d98632
commit
c42ac644eb
3 changed files with 16 additions and 17 deletions
|
@ -55,7 +55,7 @@ private class MusicGraphBuilderImpl : MusicGraph.Builder {
|
|||
private val playlistVertices = mutableSetOf<PlaylistVertex>()
|
||||
|
||||
override fun add(preSong: PreSong) {
|
||||
val uid = preSong.computeUid()
|
||||
val uid = preSong.uid
|
||||
if (songVertices.containsKey(uid)) {
|
||||
return
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ internal interface SongCore {
|
|||
internal class SongImpl(private val handle: SongCore) : Song {
|
||||
private val preSong = handle.preSong
|
||||
|
||||
override val uid = preSong.computeUid()
|
||||
override val uid = preSong.uid
|
||||
override val name = preSong.name
|
||||
override val track = preSong.track
|
||||
override val disc = preSong.disc
|
||||
|
|
|
@ -53,8 +53,7 @@ internal data class PreSong(
|
|||
val preArtists: List<PreArtist>,
|
||||
val preGenres: List<PreGenre>
|
||||
) {
|
||||
fun computeUid() =
|
||||
musicBrainzId?.let { Music.UID.musicBrainz(Music.UID.Item.SONG, it) }
|
||||
val uid = musicBrainzId?.let { Music.UID.musicBrainz(Music.UID.Item.SONG, it) }
|
||||
?: Music.UID.auxio(Music.UID.Item.SONG) {
|
||||
// Song UIDs are based on the raw data without parsing so that they remain
|
||||
// consistent across music setting changes. Parents are not held up to the
|
||||
|
|
Loading…
Reference in a new issue