bunch of work on Subsonic mediaprovider adapter

This commit is contained in:
Drew Weymouth
2023-05-14 17:48:06 -07:00
parent c4436a4887
commit e34497ec24
5 changed files with 664 additions and 1 deletions
@@ -0,0 +1,33 @@
package subsonic
import (
"log"
"strconv"
"github.com/dweymouth/go-subsonic/subsonic"
)
type searchIterBase struct {
query string
artistOffset int
albumOffset int
songOffset int
s *subsonic.Client
}
func (s *searchIterBase) fetchResults() *subsonic.SearchResult3 {
searchOpts := map[string]string{
"artistOffset": strconv.Itoa(s.artistOffset),
"albumOffset": strconv.Itoa(s.albumOffset),
"songOffset": strconv.Itoa(s.songOffset),
}
results, err := s.s.Search3(s.query, searchOpts)
if err != nil {
log.Println(err)
results = nil
}
if results == nil || len(results.Album)+len(results.Artist)+len(results.Song) == 0 {
return nil
}
return results
}