Fix #115: add search to artists, genres, and playlists pages

This commit is contained in:
Drew Weymouth
2023-04-10 17:38:33 -07:00
parent f95632a43c
commit 19a45b7361
4 changed files with 107 additions and 20 deletions
+10
View File
@@ -25,6 +25,16 @@ func IntSliceContains(slice []int, i int) bool {
return false
}
func FilterSlice[T any](ss []T, test func(T) bool) []T {
result := make([]T, 0)
for _, s := range ss {
if test(s) {
result = append(result, s)
}
}
return result
}
func FindTrackByID(id string, tracks []*subsonic.Child) *subsonic.Child {
for _, tr := range tracks {
if id == tr.ID {