From bd42d69538d06d881e7564bcad9e9213f88fa8ce Mon Sep 17 00:00:00 2001 From: Alexander Capehart Date: Fri, 15 Aug 2025 11:42:25 -0600 Subject: [PATCH] musikr.graph: avoid bad melding of nonmbid verts --- .../src/main/java/org/oxycblt/musikr/graph/MusicGraph.kt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/musikr/src/main/java/org/oxycblt/musikr/graph/MusicGraph.kt b/musikr/src/main/java/org/oxycblt/musikr/graph/MusicGraph.kt index 3dda8bb6e..5254bbba1 100644 --- a/musikr/src/main/java/org/oxycblt/musikr/graph/MusicGraph.kt +++ b/musikr/src/main/java/org/oxycblt/musikr/graph/MusicGraph.kt @@ -255,7 +255,9 @@ private class MusicGraphBuilderImpl : MusicGraph.Builder { } // second pass: cluster artists by mbid and identify invalid ones // (i.e artists with the same mbid but different metadata) - val mbidClusters = artistVertices.values.groupBy { it.preArtist.musicBrainzId } + // this only applies to artists w/mbids, if we dont do this well meld all non-mbid + // artists into a single vertex which is incorrect + val mbidClusters = artistVertices.values.groupBy { it.preArtist.musicBrainzId }.filter { it.key != null } for (cluster in mbidClusters.values) { // everything in the cluster must have the same pre-artist val canon = cluster.maxBy { it.songVertices.size }.preArtist @@ -278,7 +280,9 @@ private class MusicGraphBuilderImpl : MusicGraph.Builder { } // second pass: cluster albums by mbid and identify invalid ones // (i.e albums with the same mbid but different metadata) - val mbidAlbumClusters = albumVertices.values.groupBy { it.preAlbum.musicBrainzId } + // this only applies to albums w/mbids, if we dont do this well meld all non-mbid + // albums into a single vertex which is incorrect + val mbidAlbumClusters = albumVertices.values.groupBy { it.preAlbum.musicBrainzId }.filter { it.key != null } for (cluster in mbidAlbumClusters.values) { // everything in the cluster must have the same pre-album val canon = cluster.maxBy { it.songVertices.size }.preAlbum