add similar songs fallback when server returns none

This commit is contained in:
Drew Weymouth
2024-06-24 08:23:49 -07:00
parent 17dfa1132f
commit 7f6335c428
3 changed files with 38 additions and 0 deletions
@@ -10,6 +10,7 @@ import (
"github.com/dweymouth/go-jellyfin"
"github.com/dweymouth/supersonic/backend/mediaprovider"
"github.com/dweymouth/supersonic/backend/mediaprovider/helpers"
"github.com/dweymouth/supersonic/sharedutil"
)
@@ -480,5 +481,12 @@ func (j *jellyfinMediaProvider) GetSongRadio(trackID string, count int) ([]*medi
if err != nil {
return nil, err
}
if len(tr) == 0 {
track, err := j.GetTrack(trackID)
if err != nil {
return nil, err
}
return helpers.GetSimilarSongsFallback(j, track, count), nil
}
return sharedutil.MapSlice(tr, toTrack), nil
}