misc: Implement Iterator approach for artists

First step towards improving sorting for Artists. Use the same iterator
approach as albums and tracks.
This commit is contained in:
Michael Manganiello
2024-03-06 00:54:16 -03:00
parent 50980e7d56
commit 2cb002dde0
7 changed files with 140 additions and 30 deletions
+8 -4
View File
@@ -2,7 +2,6 @@ package browsing
import (
"fmt"
"log"
"strings"
"fyne.io/fyne/v2"
@@ -111,9 +110,14 @@ func (a *ArtistsPage) Reload() {
}
func (a *ArtistsPage) load() {
artists, err := a.mp.GetArtists()
if err != nil {
log.Printf("error loading artists: %v", err.Error())
iter := a.mp.IterateArtists("")
var artists []*mediaprovider.Artist
for {
artist := iter.Next()
if artist == nil {
break
}
artists = append(artists, artist)
}
a.artists = artists
a.onSearched(a.searcher.Entry.Text, true)