musikr: reformat
This commit is contained in:
parent
55d3bd79ba
commit
2fd4fd751f
3 changed files with 27 additions and 5 deletions
|
@ -27,14 +27,17 @@ internal class PlaylistGraph {
|
|||
|
||||
fun link(vertex: PlaylistVertex) {
|
||||
for ((pointer, songVertex) in pointerMap) {
|
||||
// Link the vertices we are already aware of to this vertex.
|
||||
vertex.pointerMap[pointer]?.forEach { index -> vertex.songVertices[index] = songVertex }
|
||||
}
|
||||
vertices.add(vertex)
|
||||
}
|
||||
|
||||
fun link(vertex: SongVertex) {
|
||||
val pointer = SongPointer.UID(vertex.preSong.uid)
|
||||
pointerMap[pointer] = vertex
|
||||
for (playlistVertex in vertices) {
|
||||
// Retroactively update previously known playlists to add the new vertex.
|
||||
playlistVertex.pointerMap[pointer]?.forEach { index ->
|
||||
playlistVertex.songVertices[index] = vertex
|
||||
}
|
||||
|
|
|
@ -30,14 +30,16 @@ internal class SongGraph(
|
|||
private val vertices = mutableMapOf<Music.UID, SongVertex>()
|
||||
|
||||
fun link(vertex: SongVertex): Boolean {
|
||||
val preSong = vertex.preSong
|
||||
val uid = preSong.uid
|
||||
val uid = vertex.preSong.uid
|
||||
if (vertices.containsKey(uid)) {
|
||||
// Discard songs with duplicate ID's, they wreck the entire
|
||||
// music model and they're pretty much always the same file.
|
||||
return false
|
||||
}
|
||||
// Link the vertex to the rest of the graph now.
|
||||
albumGraph.link(vertex)
|
||||
artistGraph.link(vertex)
|
||||
genreGraph.link(vertex)
|
||||
albumGraph.link(vertex)
|
||||
playlistGraph.link(vertex)
|
||||
vertices[uid] = vertex
|
||||
return true
|
||||
|
|
|
@ -1,5 +1,22 @@
|
|||
package org.oxycblt.musikr.tag.interpret
|
||||
/*
|
||||
* Copyright (c) 2025 Auxio Project
|
||||
* ID3Genre.kt is part of Auxio.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package org.oxycblt.musikr.tag.interpret
|
||||
|
||||
/**
|
||||
* Parse a multi-value genre name using ID3 rules. This will convert any ID3v1 integer
|
||||
|
|
Loading…
Reference in a new issue