Pass entity bookmarkedAt when updating artists and albums

This commit is contained in:
vfsfitvnm 2022-10-04 08:38:33 +02:00
parent cbfc41f57e
commit ccf5a35ff6
4 changed files with 6 additions and 17 deletions

View file

@ -40,7 +40,6 @@ import it.vfsfitvnm.vimusic.models.DetailedSong
import it.vfsfitvnm.vimusic.models.DetailedSongWithContentLength import it.vfsfitvnm.vimusic.models.DetailedSongWithContentLength
import it.vfsfitvnm.vimusic.models.Event import it.vfsfitvnm.vimusic.models.Event
import it.vfsfitvnm.vimusic.models.Format import it.vfsfitvnm.vimusic.models.Format
import it.vfsfitvnm.vimusic.models.PartialArtist
import it.vfsfitvnm.vimusic.models.Playlist import it.vfsfitvnm.vimusic.models.Playlist
import it.vfsfitvnm.vimusic.models.PlaylistPreview import it.vfsfitvnm.vimusic.models.PlaylistPreview
import it.vfsfitvnm.vimusic.models.PlaylistWithSongs import it.vfsfitvnm.vimusic.models.PlaylistWithSongs
@ -427,9 +426,6 @@ interface Database {
@Upsert @Upsert
fun upsert(artist: Artist) fun upsert(artist: Artist)
@Upsert(Artist::class)
fun upsert(artist: PartialArtist)
@Delete @Delete
fun delete(searchQuery: SearchQuery) fun delete(searchQuery: SearchQuery)

View file

@ -1,9 +0,0 @@
package it.vfsfitvnm.vimusic.models
data class PartialArtist(
val id: String,
val name: String?,
val thumbnailUrl: String?,
val info: String?,
val timestamp: Long? = null,
)

View file

@ -104,7 +104,8 @@ fun AlbumScreen(browseId: String) {
year = albumPage.year, year = albumPage.year,
authorsText = albumPage.authors?.joinToString("") { it.name ?: "" }, authorsText = albumPage.authors?.joinToString("") { it.name ?: "" },
shareUrl = albumPage.url, shareUrl = albumPage.url,
timestamp = System.currentTimeMillis() timestamp = System.currentTimeMillis(),
bookmarkedAt = album?.bookmarkedAt
), ),
albumPage albumPage
.songsPage .songsPage

View file

@ -32,7 +32,7 @@ import it.vfsfitvnm.route.RouteHandler
import it.vfsfitvnm.vimusic.Database import it.vfsfitvnm.vimusic.Database
import it.vfsfitvnm.vimusic.LocalPlayerServiceBinder import it.vfsfitvnm.vimusic.LocalPlayerServiceBinder
import it.vfsfitvnm.vimusic.R import it.vfsfitvnm.vimusic.R
import it.vfsfitvnm.vimusic.models.PartialArtist import it.vfsfitvnm.vimusic.models.Artist
import it.vfsfitvnm.vimusic.query import it.vfsfitvnm.vimusic.query
import it.vfsfitvnm.vimusic.savers.ArtistSaver import it.vfsfitvnm.vimusic.savers.ArtistSaver
import it.vfsfitvnm.vimusic.savers.InnertubeAlbumsPageSaver import it.vfsfitvnm.vimusic.savers.InnertubeAlbumsPageSaver
@ -103,12 +103,13 @@ fun ArtistScreen(browseId: String) {
query { query {
Database.upsert( Database.upsert(
PartialArtist( Artist(
id = browseId, id = browseId,
name = artistPage.name, name = artistPage.name,
thumbnailUrl = artistPage.thumbnail?.url, thumbnailUrl = artistPage.thumbnail?.url,
info = artistPage.description, info = artistPage.description,
timestamp = System.currentTimeMillis() timestamp = System.currentTimeMillis(),
bookmarkedAt = artist?.bookmarkedAt
) )
) )
} }