music: fix incorrect cache fields

Fix incorrectly populated cache fields.
This commit is contained in:
Alexander Capehart 2022-12-29 20:04:05 -07:00
parent 57ed102cda
commit 6db50a0e45
No known key found for this signature in database
GPG key ID: 37DBE3621FE9AD47
3 changed files with 5 additions and 5 deletions

View file

@ -48,6 +48,7 @@ audio focus was lost
#### Dev/Meta
- Created new wiki with more information about app functionality
- Switched to issue forms
- Completed migration to reactive playback system
- Refactor music backends into a unified chain of extractors
- Add bluetooth connection reciever (No functionality in app yet)

View file

@ -23,7 +23,6 @@ import android.database.sqlite.SQLiteDatabase
import android.database.sqlite.SQLiteOpenHelper
import androidx.core.database.getIntOrNull
import androidx.core.database.getStringOrNull
import java.io.File
import org.oxycblt.auxio.music.Song
import org.oxycblt.auxio.util.*
@ -247,7 +246,7 @@ private class CacheDatabase(context: Context) :
cursor.getColumnIndexOrThrow(Columns.ALBUM_MUSIC_BRAINZ_ID)
val albumNameIndex = cursor.getColumnIndexOrThrow(Columns.ALBUM_NAME)
val albumSortNameIndex = cursor.getColumnIndexOrThrow(Columns.ALBUM_SORT_NAME)
val albumReleaseTypesIndex = cursor.getColumnIndexOrThrow(Columns.ALBUM_TYPES)
val albumTypesIndex = cursor.getColumnIndexOrThrow(Columns.ALBUM_TYPES)
val artistMusicBrainzIdsIndex =
cursor.getColumnIndexOrThrow(Columns.ARTIST_MUSIC_BRAINZ_IDS)
@ -284,7 +283,7 @@ private class CacheDatabase(context: Context) :
raw.albumMusicBrainzId = cursor.getStringOrNull(albumMusicBrainzIdIndex)
raw.albumName = cursor.getString(albumNameIndex)
raw.albumSortName = cursor.getStringOrNull(albumSortNameIndex)
cursor.getStringOrNull(albumReleaseTypesIndex)?.parseSQLMultiValue()?.let {
cursor.getStringOrNull(albumTypesIndex)?.parseSQLMultiValue()?.let {
raw.albumTypes = it
}
@ -338,7 +337,7 @@ private class CacheDatabase(context: Context) :
put(Columns.SIZE, rawSong.size)
put(Columns.DURATION, rawSong.durationMs)
put(Columns.MUSIC_BRAINZ_ID, rawSong.name)
put(Columns.MUSIC_BRAINZ_ID, rawSong.musicBrainzId)
put(Columns.NAME, rawSong.name)
put(Columns.SORT_NAME, rawSong.sortName)

View file

@ -76,7 +76,7 @@ fun String.parseTimestamp() = Date.from(this)
* @param selector A block that determines if the string should be split at a given character.
* @return One or more [String]s split by the selector.
*/
inline fun String.splitEscaped(selector: (Char) -> Boolean): MutableList<String> {
inline fun String.splitEscaped(selector: (Char) -> Boolean): List<String> {
val split = mutableListOf<String>()
var currentString = ""
var i = 0