Hi all, happy Friday!
I searched for similar topics but it seems I’m the one who posts about related songs the most
Unsure if that’s a good thing or a bad thing, but at least it shows I use it a lot ![]()
Context: I have started to rate songs in Plex a lot more for the last year, to the point where I have some artists where most songs are rated, from 1-5 stars (well, sometimes from 1-10, as I’m using the half-star rating on PlexAmp). What I have started to notice is that the related song recommendations for those artists started to be somewhat suboptimal in this case, but were different when you were playing a song by the artist.
I narrowed it down to the two following queries:
- Poor recommendations on a rated library: When you are listening to a song from a related artist, the query will ask for songs rated >= 4 out of 10, sorted by last played. For a highly rated artist library, this consistently yields poor choices. My recommendations end up being songs that are 2-3 stars songs that I haven’t listened to the longest. Since I don’t select any of them (well, for clear reasons), these end up being the ones that are always recommended. This is the query that gets the related songs for the current track:
/library/sections/1/all?sort=lastViewedAt&type=10&track.userRating>=4&artist.id=[redacted1],[redacted2],[redacted3],[redacted4]&excludeFields=summary&excludeElements=Mood,Similar,Genre,Style,Country,Media&includeFields=thumbBlurHash
-
Good recommendations, but will repeat recommendations unless they’re in the queue: If you’re listening to a song from the artist, the query is now different, and will ask for artist songs sorted by user rating, in descending order, and trims the list at 10 I believe. This ignores when you last heard the song, but yields good recommendations. When those 10 end, it will recommend songs that I believe relate to the artist’s most popular songs. When you exhaust those, no more artist recommendations will be presented when you’re playing a song from that artist.
Here’s the query for the top user rated:
/library/sections/1/all?artist.id=[Redacted]&type=10&group=guid&sort=userRating:desc&userRating%3E=5&limit=10&excludeFields=summary&excludeElements=Mood,Similar,Genre,Style,Country,Media&includeFields=thumbBlurHash
and here’s the one for the most popular songs:
/library/sections/1/all?artist.id=[Redacted]&type=10&sort=ratingCount:desc&group=guid&limit=10&excludeFields=summary&excludeElements=Mood,Similar,Genre,Style,Country,Media&includeFields=thumbBlurHash
So, now that I’ve been playing a bit with this, I have a couple of questions if I may:
- Is there an easy way to do combined sorts in these requests? When I add a second sort parameter, the last one overrides the first one. I’d like to try out a few combinations to see if it can improve the related songs - such as sort by top rated and last played, rather than just last played, to see if it improves things.
- Alternatively - or in addition - could we not just add a window to the “last played”, say, anything that was played over a week ago is fair to recommend again? The SQL query would be easy to create, but we likely can’t do that without knowing the database [NOW] timestamp. But adding a lastViewedAt <= [one week ago/whatever threshold makes sense] could alleviate this.
- If not, can we increase the ratings threshold for the last played (can be user set if it’s too convoluted). In my case, with a highly curated library for those artists, I should probably only want recommendations of 4 and 5 star songs (or even 5 star songs only, though I can understand that if there aren’t many we’ll always repeat the same so that’s not ideal). Also, unsure how this would affect unrated items being recommended.
- Last but not least, could we be able to mark a suggestion as “skipped”, and simply not show it anymore in that session - or for a period of time, depending if you’d store that info client-side or server-side? We would need to increase the “limit” from the queries to get more songs, though, so that we get more songs.
Just a few thoughts and feedback in this regard, but would love to hear your thoughts. Also, and again, if we can do combined joins let me know the syntax and I’ll happily play with things.
Above all, keep up the great work. ![]()
Regards, and have a great weekend.