musikr: reformat

This commit is contained in:
Alexander Capehart
2025-08-14 16:40:29 -06:00
parent 8603731eff
commit b3cdda0cba
2 changed files with 6 additions and 8 deletions
@@ -29,7 +29,6 @@ import org.oxycblt.musikr.tag.interpret.PreArtistsFrom
import org.oxycblt.musikr.tag.interpret.PreGenre import org.oxycblt.musikr.tag.interpret.PreGenre
import org.oxycblt.musikr.tag.interpret.PreSong import org.oxycblt.musikr.tag.interpret.PreSong
import org.oxycblt.musikr.util.unlikelyToBeNull import org.oxycblt.musikr.util.unlikelyToBeNull
import java.util.UUID
internal data class MusicGraph( internal data class MusicGraph(
val songVertex: List<SongVertex>, val songVertex: List<SongVertex>,
@@ -255,9 +254,8 @@ private class MusicGraphBuilderImpl : MusicGraph.Builder {
simplifyArtistCluster(cluster) simplifyArtistCluster(cluster)
} }
// second pass: cluster artists by mbid and identify invalid ones // second pass: cluster artists by mbid and identify invalid ones
// (i.e artists with the same mbid but different metdata) // (i.e artists with the same mbid but different metadata)
val mbidClusters = val mbidClusters = artistVertices.values.groupBy { it.preArtist.musicBrainzId }
artistVertices.values.groupBy { it.preArtist.musicBrainzId }
for (cluster in mbidClusters.values) { for (cluster in mbidClusters.values) {
// everything in the cluster must have the same pre-artist // everything in the cluster must have the same pre-artist
val canon = cluster.maxBy { it.songVertices.size }.preArtist val canon = cluster.maxBy { it.songVertices.size }.preArtist
@@ -273,7 +271,6 @@ private class MusicGraphBuilderImpl : MusicGraph.Builder {
} }
} }
// first pass: cluster albums by name and process MBIDs where valid // first pass: cluster albums by name and process MBIDs where valid
val albumClusters = albumVertices.values.groupBy { it.preAlbum.rawName?.lowercase() } val albumClusters = albumVertices.values.groupBy { it.preAlbum.rawName?.lowercase() }
for (cluster in albumClusters.values) { for (cluster in albumClusters.values) {
@@ -281,8 +278,7 @@ private class MusicGraphBuilderImpl : MusicGraph.Builder {
} }
// second pass: cluster albums by mbid and identify invalid ones // second pass: cluster albums by mbid and identify invalid ones
// (i.e albums with the same mbid but different metadata) // (i.e albums with the same mbid but different metadata)
val mbidAlbumClusters = val mbidAlbumClusters = albumVertices.values.groupBy { it.preAlbum.musicBrainzId }
albumVertices.values.groupBy { it.preAlbum.musicBrainzId }
for (cluster in mbidAlbumClusters.values) { for (cluster in mbidAlbumClusters.values) {
// everything in the cluster must have the same pre-album // everything in the cluster must have the same pre-album
val canon = cluster.maxBy { it.songVertices.size }.preAlbum val canon = cluster.maxBy { it.songVertices.size }.preAlbum
@@ -45,7 +45,9 @@ internal class ArtistImpl(private val core: ArtistCore) : Artist {
override val uid = override val uid =
// Attempt to use a MusicBrainz ID first before falling back to a hashed UID. // Attempt to use a MusicBrainz ID first before falling back to a hashed UID.
core.preArtist.musicBrainzId?.let { Music.UID.musicBrainz(Music.UID.Item.ARTIST, it) } core.preArtist.musicBrainzId?.let { Music.UID.musicBrainz(Music.UID.Item.ARTIST, it) }
?: Music.UID.auxio(Music.UID.Item.ARTIST) { update(core.preArtist.rawName.also { Log.d("ArtistImpl", it.toString()) }) } ?: Music.UID.auxio(Music.UID.Item.ARTIST) {
update(core.preArtist.rawName.also { Log.d("ArtistImpl", it.toString()) })
}
override val name = core.preArtist.name override val name = core.preArtist.name
override val songs = core.songs override val songs = core.songs