include playlists and genres in results; UI improvement

This commit is contained in:
Drew Weymouth
2023-11-05 14:07:52 -08:00
parent 7aa94dd357
commit 3238aad65a
2 changed files with 78 additions and 19 deletions
+21 -2
View File
@@ -39,7 +39,7 @@ func (s *subsonicMediaProvider) SearchAll(searchQuery string, maxResults int) ([
wg.Add(1)
go func() {
p, e := s.client.GetPlaylists(nil)
if e != nil {
if e == nil {
playlists = sharedutil.FilterSlice(p, func(p *subsonic.Playlist) bool {
return allTermsMatch(strings.ToLower(p.Name), queryLowerWords)
})
@@ -50,7 +50,7 @@ func (s *subsonicMediaProvider) SearchAll(searchQuery string, maxResults int) ([
wg.Add(1)
go func() {
g, e := s.client.GetGenres()
if e != nil {
if e == nil {
genres = sharedutil.FilterSlice(g, func(g *subsonic.Genre) bool {
return allTermsMatch(strings.ToLower(g.Name), queryLowerWords)
})
@@ -120,6 +120,25 @@ func mergeResults(
})
}
for _, pl := range matchingPlaylists {
results = append(results, &mediaprovider.SearchResult{
Type: mediaprovider.ContentTypePlaylist,
ID: pl.ID,
CoverID: pl.CoverArt,
Name: pl.Name,
Size: pl.SongCount,
})
}
for _, g := range matchingGenres {
results = append(results, &mediaprovider.SearchResult{
Type: mediaprovider.ContentTypeGenre,
ID: g.Name,
Name: g.Name,
Size: g.AlbumCount,
})
}
return results
}