music: only compute song uid once
This commit is contained in:
parent
dd3b411beb
commit
e0bbb88e92
3 changed files with 3 additions and 3 deletions
|
@ -85,7 +85,7 @@ class InterpreterImpl @Inject constructor(private val preparer: Preparer) : Inte
|
|||
val uidMap = mutableMapOf<Music.UID, SongImpl>()
|
||||
val songs =
|
||||
albumLinkedSongs.mapNotNull {
|
||||
val uid = it.preSong.computeUid()
|
||||
val uid = it.preSong.uid
|
||||
val other = uidMap[uid]
|
||||
if (other == null) {
|
||||
SongImpl(it)
|
||||
|
|
|
@ -43,7 +43,7 @@ import org.oxycblt.auxio.util.update
|
|||
class SongImpl(linkedSong: LinkedSong) : Song {
|
||||
private val preSong = linkedSong.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
|
||||
|
|
|
@ -52,7 +52,7 @@ data class PreSong(
|
|||
val preArtists: List<PreArtist>,
|
||||
val preGenres: List<PreGenre>
|
||||
) {
|
||||
fun computeUid() =
|
||||
val uid =
|
||||
musicBrainzId?.let { Music.UID.musicBrainz(MusicType.SONGS, it) }
|
||||
?: Music.UID.auxio(MusicType.SONGS) {
|
||||
// Song UIDs are based on the raw data without parsing so that they remain
|
||||
|
|
Loading…
Reference in a new issue