Clear SongAlbumMaps before upserting new album data

This commit is contained in:
vfsfitvnm 2022-10-26 12:40:13 +02:00
parent 2d632c19de
commit f4a55ff2ad
2 changed files with 5 additions and 0 deletions

View file

@ -305,6 +305,9 @@ interface Database {
@Query("DELETE FROM SongPlaylistMap WHERE playlistId = :id") @Query("DELETE FROM SongPlaylistMap WHERE playlistId = :id")
fun clearPlaylist(id: Long) fun clearPlaylist(id: Long)
@Query("DELETE FROM SongAlbumMap WHERE albumId = :id")
fun clearAlbum(id: String)
@Query("SELECT loudnessDb FROM Format WHERE songId = :songId") @Query("SELECT loudnessDb FROM Format WHERE songId = :songId")
fun loudnessDb(songId: String): Flow<Float?> fun loudnessDb(songId: String): Flow<Float?>

View file

@ -79,6 +79,8 @@ fun AlbumScreen(browseId: String) {
?.onSuccess { currentAlbumPage -> ?.onSuccess { currentAlbumPage ->
albumPage = currentAlbumPage albumPage = currentAlbumPage
Database.clearAlbum(browseId)
Database.upsert( Database.upsert(
Album( Album(
id = browseId, id = browseId,