From 1ddc6dc8a966ba0077dafbf216c362c8a198fa66 Mon Sep 17 00:00:00 2001 From: Drew Weymouth Date: Mon, 24 Jun 2024 08:25:49 -0700 Subject: [PATCH] exclude track itself from similar tracks in either codepath --- backend/mediaprovider/helpers/similar.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/backend/mediaprovider/helpers/similar.go b/backend/mediaprovider/helpers/similar.go index b238ba26..f87871ee 100644 --- a/backend/mediaprovider/helpers/similar.go +++ b/backend/mediaprovider/helpers/similar.go @@ -9,11 +9,10 @@ func GetSimilarSongsFallback(mp mediaprovider.MediaProvider, track *mediaprovide var tracks []*mediaprovider.Track if len(track.ArtistIDs) > 0 { tracks, _ = mp.GetSimilarTracks(track.ArtistIDs[0], count) - if len(tracks) > 0 { - return tracks - } } - tracks, _ = mp.GetRandomTracks(track.Genre, count) + if len(tracks) == 0 { + tracks, _ = mp.GetRandomTracks(track.Genre, count) + } // make sure to exclude the song itself from the similar list return sharedutil.FilterSlice(tracks, func(t *mediaprovider.Track) bool {