feat: bootstrap MusicManager with scanner and Subsonic auth

- Gradle/Kotlin/Ktor project on JVM 21 with ShadowJar
- SQLite WAL, Flyway migrations and config-driven users/folders
- deterministic IDs, MP3 tag extraction, cover cache and delta scanner
- OpenSubsonic JSON envelope with token/password authentication
- system endpoints: ping, license, extensions, scan status
This commit is contained in:
TapTap committed 2026-11-13 11:42:57 +00:00
1 parent 961341b449
commit e194badefb
45 files changed
+4079 -126

No files matched your search

@@ -0,0 +1,56 @@
package win.taptap.musicmanager.util
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertNotEquals
import kotlin.test.assertTrue
class IdGeneratorTest {
@Test
fun `normalization is NFC, trimmed, collapsed and lowercase`() {
val decomposed = "Cafe\u0301 The Artist"
assertEquals("café the artist", IdGenerator.normalize(decomposed))
assertEquals(IdGenerator.normalize(" THE Artist "), IdGenerator.normalize("the artist"))
}
@Test
fun `IDs are deterministic, prefixed and 24 hex characters`() {
val first = IdGenerator.artistId("The Beatles")
val second = IdGenerator.artistId("the beatles")
assertEquals(first, second)
assertTrue(first.startsWith("ar-"))
assertEquals(27, first.length)
val album = IdGenerator.albumId("The Beatles", "Abbey Road")
assertTrue(album.startsWith("al-"))
assertEquals(27, album.length)
val song = IdGenerator.songId(1, "The Beatles/Abbey Road/01 - Come Together.mp3")
assertTrue(song.startsWith("sg-"))
assertEquals(27, song.length)
}
@Test
fun `path separators do not change the song ID`() {
val unix = IdGenerator.songId(1, "Artist/Album/song.mp3")
val windows = IdGenerator.songId(1, "Artist\\Album\\song.mp3")
val prefixed = IdGenerator.songId(1, "./Artist/Album/song.mp3")
assertEquals(unix, windows)
assertEquals(unix, prefixed)
}
@Test
fun `folder and album changes produce different IDs`() {
assertNotEquals(
IdGenerator.songId(1, "Artist/Album/song.mp3"),
IdGenerator.songId(2, "Artist/Album/song.mp3"),
)
assertNotEquals(
IdGenerator.albumId("Artist", "Album"),
IdGenerator.albumId("Artist", "Other Album"),
)
}
}