musikr: fix graphing error w/certain link steps

I wasn't correctly linking genres, which would cascade to a dead vertex
down the line.

Will need better diagnostics here.
This commit is contained in:
Alexander Capehart 2025-01-08 17:17:05 -07:00
parent 0e34a28dfb
commit 3d690eb637
No known key found for this signature in database
GPG key ID: 37DBE3621FE9AD47

View file

@ -18,6 +18,7 @@
package org.oxycblt.musikr.graph package org.oxycblt.musikr.graph
import android.util.Log
import org.oxycblt.musikr.Music import org.oxycblt.musikr.Music
import org.oxycblt.musikr.playlist.SongPointer import org.oxycblt.musikr.playlist.SongPointer
import org.oxycblt.musikr.playlist.interpret.PrePlaylist import org.oxycblt.musikr.playlist.interpret.PrePlaylist
@ -148,12 +149,14 @@ private class MusicGraphBuilderImpl : MusicGraph.Builder {
} }
} }
return MusicGraph( val graph = MusicGraph(
songVertices.values.toList(), songVertices.values.toList(),
albumVertices.values.toList(), albumVertices.values.toList(),
artistVertices.values.toList(), artistVertices.values.toList(),
genreVertices.values.toList(), genreVertices.values.toList(),
playlistVertices) playlistVertices)
return graph
} }
private fun simplifyGenreCluster(cluster: Collection<GenreVertex>) { private fun simplifyGenreCluster(cluster: Collection<GenreVertex>) {
@ -240,6 +243,7 @@ private class MusicGraphBuilderImpl : MusicGraph.Builder {
// Link all songs and albums from the irrelevant artist to the relevant artist. // Link all songs and albums from the irrelevant artist to the relevant artist.
dst.songVertices.addAll(src.songVertices) dst.songVertices.addAll(src.songVertices)
dst.albumVertices.addAll(src.albumVertices) dst.albumVertices.addAll(src.albumVertices)
dst.genreVertices.addAll(src.genreVertices)
// Update all songs, albums, and genres to point to the relevant artist. // Update all songs, albums, and genres to point to the relevant artist.
src.songVertices.forEach { src.songVertices.forEach {
val index = it.artistVertices.indexOf(src) val index = it.artistVertices.indexOf(src)