musikr: correctly strip extensions from files
Otherwise I can mangle filenames that are just dots.
This commit is contained in:
parent
59c33b9be2
commit
ddeba2c496
1 changed files with 3 additions and 1 deletions
|
@ -67,6 +67,8 @@ private class TagInterpreterImpl(private val interpretation: Interpretation) : T
|
|||
val songNameOrFile = song.tags.name ?: requireNotNull(song.file.path.name)
|
||||
val songNameOrFileWithoutExt =
|
||||
song.tags.name ?: requireNotNull(song.file.path.name).split('.').first()
|
||||
val songNameOrFileWithoutExtCorrect =
|
||||
song.tags.name ?: requireNotNull(song.file.path.name).split('.').dropLast(1).joinToString('.')
|
||||
val albumNameOrDir = song.tags.albumName ?: song.file.path.directory.name
|
||||
|
||||
val musicBrainzId = song.tags.musicBrainzId?.toUuidOrNull()
|
||||
|
@ -114,7 +116,7 @@ private class TagInterpreterImpl(private val interpretation: Interpretation) : T
|
|||
addedMs = song.addedMs,
|
||||
musicBrainzId = musicBrainzId,
|
||||
name = interpretation.naming.name(songNameOrFileWithoutExt, song.tags.sortName),
|
||||
rawName = songNameOrFileWithoutExt,
|
||||
rawName = songNameOrFileWithoutExtCorrect,
|
||||
track = song.tags.track,
|
||||
disc = song.tags.disc?.let { Disc(it, song.tags.subtitle) },
|
||||
date = song.tags.date,
|
||||
|
|
Loading…
Reference in a new issue