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 f8fbcac482
commit 87bb47cec3
No known key found for this signature in database
GPG key ID: 37DBE3621FE9AD47
4 changed files with 8 additions and 11 deletions

View file

@ -2,16 +2,10 @@
## dev ## dev
#### What's New
- Menus have been refreshed with a cleaner look
#### What's Fixed #### What's Fixed
- Fixed issue where one could not navigate to settings after navigating - Fixed issue where one could not navigate to settings after navigating elsewhere
elsewhere
- Fixed the queue list being non-scrollable in certain cases - Fixed the queue list being non-scrollable in certain cases
- Fixed negative ReplayGain adjustments not being applied
#### Dev/Meta
- Unified navigation graph
## 3.1.3 ## 3.1.3

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,10 @@ 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()
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.