more work on artist list page

This commit is contained in:
Drew Weymouth
2023-01-14 16:52:13 -08:00
parent ab72d0dbdd
commit 760bab1ee3
7 changed files with 117 additions and 63 deletions
+26 -1
View File
@@ -37,6 +37,7 @@ func NewArtistsPage(sm *backend.ServerManager, nav func(Route)) *ArtistsPage {
a.list.ShowAlbumCount = true
a.list.ShowTrackCount = false
a.buildContainer()
go a.loadAsync()
return a
}
@@ -46,7 +47,31 @@ func (a *ArtistsPage) loadAsync() {
log.Printf("error loading artists: %v", err.Error())
}
a.list.Items = a.buildListModel(artists)
a.list.Refresh()
a.Refresh()
}
func (a *ArtistsPage) Route() Route {
return ArtistsRoute()
}
func (a *ArtistsPage) Reload() {
go a.loadAsync()
}
func (a *ArtistsPage) Save() SavedPage {
return &savedArtistsPage{
sm: a.sm,
nav: a.nav,
}
}
type savedArtistsPage struct {
sm *backend.ServerManager
nav func(Route)
}
func (s *savedArtistsPage) Restore() Page {
return NewArtistsPage(s.sm, s.nav)
}
func (a *ArtistsPage) buildListModel(artists *subsonic.ArtistsID3) []widgets.ArtistGenrePlaylistItemModel {