mirror of
https://github.com/navidrome/navidrome.git
synced 2025-05-14 00:56:37 +03:00
Now returns all tracks for a given genre by a given artist
This commit is contained in:
parent
9078ed7642
commit
e8301cf864
@ -183,8 +183,26 @@ func (cds *contentDirectoryService) readContainer(o object, host string) (ret []
|
|||||||
if matchResults["GenreTrack"] != "" {
|
if matchResults["GenreTrack"] != "" {
|
||||||
log.Debug("TODO GenreTrack MATCH")
|
log.Debug("TODO GenreTrack MATCH")
|
||||||
} else if matchResults["GenreArtist"] != "" {
|
} else if matchResults["GenreArtist"] != "" {
|
||||||
log.Debug("TODO GenreArtist MATCH")
|
tracks, err := cds.ds.MediaFile(cds.ctx).GetAll(model.QueryOptions{Filters: squirrel.And{
|
||||||
|
squirrel.Eq{"genre.id": matchResults["Genre"],},
|
||||||
|
squirrel.Eq{"artist_id": matchResults["GenreArtist"]},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
fmt.Printf("Error retrieving tracks for artist and genre: %+v", err)
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
//TODO do the metadata and stuff here
|
||||||
|
for trackIndex := range tracks {
|
||||||
|
child := object {
|
||||||
|
Path: path.Join(o.Path, tracks[trackIndex].Title),
|
||||||
|
Id: path.Join(o.Path, tracks[trackIndex].ID),
|
||||||
|
}
|
||||||
|
ret = append(ret, cds.cdsObjectToUpnpavObject(child, false, host))
|
||||||
|
}
|
||||||
} else if matchResults["Genre"] != "" {
|
} else if matchResults["Genre"] != "" {
|
||||||
|
if matchResults["GenreArtist"] == "" {
|
||||||
artists, err := cds.ds.Artist(cds.ctx).GetAll(model.QueryOptions{Filters: squirrel.Eq{ "genre.id": matchResults["Genre"]}})
|
artists, err := cds.ds.Artist(cds.ctx).GetAll(model.QueryOptions{Filters: squirrel.Eq{ "genre.id": matchResults["Genre"]}})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Printf("Error retrieving artists for genre: %+v", err)
|
fmt.Printf("Error retrieving artists for genre: %+v", err)
|
||||||
@ -197,6 +215,7 @@ func (cds *contentDirectoryService) readContainer(o object, host string) (ret []
|
|||||||
}
|
}
|
||||||
ret = append(ret, cds.cdsObjectToUpnpavObject(child, true, host))
|
ret = append(ret, cds.cdsObjectToUpnpavObject(child, true, host))
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
indexes, err := cds.ds.Genre(cds.ctx).GetAll()
|
indexes, err := cds.ds.Genre(cds.ctx).GetAll()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user