music: index negative replaygain tags

Caused by an absurd error stemming from absurd helper function naming.
This commit is contained in:
Alexander Capehart 2023-07-04 15:09:47 -06:00
parent ada446767d
commit 7adf7f7beb
No known key found for this signature in database
GPG key ID: 37DBE3621FE9AD47
4 changed files with 8 additions and 3 deletions

View file

@ -10,6 +10,7 @@
- Fixed the queue list being non-scrollable in certain cases - Fixed the queue list being non-scrollable in certain cases
- Fixed notification album covers not updating after changing the cover - Fixed notification album covers not updating after changing the cover
aspect ratio setting aspect ratio setting
- Fixed negative ReplayGain adjustments not being applied
#### Dev/Meta #### Dev/Meta
- Unified navigation graph - Unified navigation graph

View file

@ -32,7 +32,7 @@ import org.oxycblt.auxio.music.info.Date
import org.oxycblt.auxio.music.metadata.correctWhitespace import org.oxycblt.auxio.music.metadata.correctWhitespace
import org.oxycblt.auxio.music.metadata.splitEscaped import org.oxycblt.auxio.music.metadata.splitEscaped
@Database(entities = [CachedSong::class], version = 32, exportSchema = false) @Database(entities = [CachedSong::class], version = 34, exportSchema = false)
abstract class CacheDatabase : RoomDatabase() { abstract class CacheDatabase : RoomDatabase() {
abstract fun cachedSongsDao(): CachedSongsDao abstract fun cachedSongsDao(): CachedSongsDao
} }

View file

@ -314,7 +314,11 @@ private class TagWorkerImpl(
* @return A parsed adjustment float, or null if the adjustment had invalid formatting. * @return A parsed adjustment float, or null if the adjustment had invalid formatting.
*/ */
private fun List<String>.parseReplayGainAdjustment() = private fun List<String>.parseReplayGainAdjustment() =
first().replace(REPLAYGAIN_ADJUSTMENT_FILTER_REGEX, "").toFloatOrNull()?.nonZeroOrNull() first()
.replace(REPLAYGAIN_ADJUSTMENT_FILTER_REGEX, "")
.toFloatOrNull()
?.nonZeroOrNull()
.also { logD(it) }
private companion object { private companion object {
val COMPILATION_ALBUM_ARTISTS = listOf("Various Artists") val COMPILATION_ALBUM_ARTISTS = listOf("Various Artists")

View file

@ -55,7 +55,7 @@ fun Long.nonZeroOrNull() = if (this > 0) this else null
* *
* @return The same number if it's non-zero, null otherwise. * @return The same number if it's non-zero, null otherwise.
*/ */
fun Float.nonZeroOrNull() = if (this > 0) this else null fun Float.nonZeroOrNull() = if (this != 0f) this else null
/** /**
* Aliases a check to ensure a given value is in a specified range. * Aliases a check to ensure a given value is in a specified range.