🎧 Your Personal Streaming Service
Go airsonicmadsonicmedia-servermusicmusic-servernavidromeopensubsonicraspberry-piself-hostedstreamerstreaming-apistreaming-audiosubsonicsubsonic-server
Using slices for Results, instead of pointers of slices
Deluancac352b18c79
diff --git a/api/searching.go b/api/searching.goindex 0f98af453..06345ebd8 100644--- a/api/searching.go+++ b/api/searching.go@@ -40,16 +40,16 @@ func (c *SearchingController) Search2() {response := c.NewEmpty()searchResult2 := &responses.SearchResult2{}- searchResult2.Artist = make([]responses.Artist, len(*as))- for i, e := range *as {+ searchResult2.Artist = make([]responses.Artist, len(as))+ for i, e := range as {searchResult2.Artist[i] = responses.Artist{Id: e.Id, Name: e.Title}}- searchResult2.Album = make([]responses.Child, len(*als))- for i, e := range *als {+ searchResult2.Album = make([]responses.Child, len(als))+ for i, e := range als {searchResult2.Album[i] = c.ToChild(e)}- searchResult2.Song = make([]responses.Child, len(*mfs))- for i, e := range *mfs {+ searchResult2.Song = make([]responses.Child, len(mfs))+ for i, e := range mfs {searchResult2.Song[i] = c.ToChild(e)}response.SearchResult2 = searchResult2diff --git a/engine/search.go b/engine/search.goindex 79988493c..c9f63eea8 100644--- a/engine/search.go+++ b/engine/search.go@@ -17,9 +17,9 @@ type Search interface {IndexAlbum(al *domain.Album) errorIndexMediaFile(mf *domain.MediaFile) error- SearchArtist(q string, offset int, size int) (*Results, error)- SearchAlbum(q string, offset int, size int) (*Results, error)- SearchSong(q string, offset int, size int) (*Results, error)+ SearchArtist(q string, offset int, size int) (Results, error)+ SearchAlbum(q string, offset int, size int) (Results, error)+ SearchSong(q string, offset int, size int) (Results, error)}type search struct {@@ -63,7 +63,7 @@ func (s search) IndexMediaFile(mf *domain.MediaFile) error {return s.idxSong.Index(mf.Id, sanitize.Accents(strings.ToLower(mf.Title)))}-func (s search) SearchArtist(q string, offset int, size int) (*Results, error) {+func (s search) SearchArtist(q string, offset int, size int) (Results, error) {q = sanitize.Accents(strings.ToLower(strings.TrimSuffix(q, "*")))min := offsetmax := min + size - 1@@ -81,10 +81,10 @@ func (s search) SearchArtist(q string, offset int, size int) (*Results, error) {res = append(res, Entry{Id: a.Id, Title: a.Name, IsDir: true})}}- return &res, nil+ return res, nil}-func (s search) SearchAlbum(q string, offset int, size int) (*Results, error) {+func (s search) SearchAlbum(q string, offset int, size int) (Results, error) {q = sanitize.Accents(strings.ToLower(strings.TrimSuffix(q, "*")))min := offsetmax := min + size - 1@@ -102,10 +102,10 @@ func (s search) SearchAlbum(q string, offset int, size int) (*Results, error) {res = append(res, FromAlbum(al))}}- return &res, nil+ return res, nil}-func (s search) SearchSong(q string, offset int, size int) (*Results, error) {+func (s search) SearchSong(q string, offset int, size int) (Results, error) {q = sanitize.Accents(strings.ToLower(strings.TrimSuffix(q, "*")))min := offsetmax := min + size - 1@@ -123,7 +123,7 @@ func (s search) SearchSong(q string, offset int, size int) (*Results, error) {res = append(res, FromMediaFile(mf))}}- return &res, nil+ return res, nil}func criticalError(kind, id string, err error) bool {