misc: Migrate Artists page to GridView

Remove custom page implementation for Artists, and instead rely on the
generic `GridView` approach. This also simplifies adding new
sorting/filtering options as next improvements.

The new `ArtistFilter` is a dummy implementation without any real
filters at the moment.

Also, the `go-jellyfin` upgrade is needed to correctly display the album
count for each artist.
This commit is contained in:
Michael Manganiello
2024-03-30 12:42:48 -03:00
parent b7e7e959ff
commit 66658b1401
12 changed files with 254 additions and 220 deletions
+13 -2
View File
@@ -124,7 +124,7 @@ func (j *jellyfinMediaProvider) IterateTracks(searchQuery string) mediaprovider.
return helpers.NewTrackIterator(fetcher, j.prefetchCoverCB)
}
func (j *jellyfinMediaProvider) IterateArtists(sortOrder string) mediaprovider.ArtistIterator {
func (j *jellyfinMediaProvider) IterateArtists(sortOrder string, filter mediaprovider.ArtistFilter) mediaprovider.ArtistIterator {
var jfSort jellyfin.Sort
if sortOrder == "" {
@@ -147,7 +147,18 @@ func (j *jellyfinMediaProvider) IterateArtists(sortOrder string) mediaprovider.A
return sharedutil.MapSlice(ar, toArtist), nil
}
return helpers.NewArtistIterator(fetcher)
return helpers.NewArtistIterator(fetcher, filter, j.prefetchCoverCB)
}
func (j *jellyfinMediaProvider) SearchArtists(searchQuery string, filter mediaprovider.ArtistFilter) mediaprovider.ArtistIterator {
fetcher := func(offs, limit int) ([]*mediaprovider.Artist, error) {
sr, err := j.client.Search(searchQuery, jellyfin.TypeArtist, jellyfin.Paging{StartIndex: offs, Limit: limit})
if err != nil {
return nil, err
}
return sharedutil.MapSlice(sr.Artists, toArtist), nil
}
return helpers.NewArtistIterator(fetcher, filter, j.prefetchCoverCB)
}
// Creates the Jellyfin filter to implement the given mediaprovider filter,