mirror of
https://github.com/navidrome/navidrome.git
synced 2025-06-18 07:53:19 +03:00
Skip ids returned from search but not found in the DB
This commit is contained in:
parent
c90a50827a
commit
aa6afdb976
@ -72,12 +72,14 @@ func (s search) SearchArtist(q string, offset int, size int) (*Results, error) {
|
|||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
res := make(Results, len(resp))
|
res := make(Results, len(resp))
|
||||||
for i, id := range resp {
|
for _, id := range resp {
|
||||||
a, err := s.artistRepo.Get(id)
|
a, err := s.artistRepo.Get(id)
|
||||||
if criticalError("Artist", id, err) {
|
if criticalError("Artist", id, err) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
res[i] = Entry{Id: a.Id, Title: a.Name, IsDir: true}
|
if err == nil {
|
||||||
|
res = append(res, Entry{Id: a.Id, Title: a.Name, IsDir: true})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return &res, nil
|
return &res, nil
|
||||||
}
|
}
|
||||||
@ -91,12 +93,14 @@ func (s search) SearchAlbum(q string, offset int, size int) (*Results, error) {
|
|||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
res := make(Results, len(resp))
|
res := make(Results, len(resp))
|
||||||
for i, id := range resp {
|
for _, id := range resp {
|
||||||
al, err := s.albumRepo.Get(id)
|
al, err := s.albumRepo.Get(id)
|
||||||
if criticalError("Album", id, err) {
|
if criticalError("Album", id, err) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
res[i] = FromAlbum(al)
|
if err == nil {
|
||||||
|
res = append(res, FromAlbum(al))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return &res, nil
|
return &res, nil
|
||||||
}
|
}
|
||||||
@ -109,13 +113,15 @@ func (s search) SearchSong(q string, offset int, size int) (*Results, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
res := make(Results, len(resp))
|
res := make(Results, 0, len(resp))
|
||||||
for i, id := range resp {
|
for _, id := range resp {
|
||||||
mf, err := s.mfileRepo.Get(id)
|
mf, err := s.mfileRepo.Get(id)
|
||||||
if criticalError("Song", id, err) {
|
if criticalError("Song", id, err) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
res[i] = FromMediaFile(mf)
|
if err == nil {
|
||||||
|
res = append(res, FromMediaFile(mf))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return &res, nil
|
return &res, nil
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user