dweymouth / supersonic

A lightweight and full-featured cross-platform desktop client for self-hosted music servers
GNU General Public License v3.0
878 stars 45 forks source link

Jellyfin: "Play Artist Station" doesn't work if you call it a second time #284

Closed adamshand closed 9 months ago

adamshand commented 10 months ago

Using the Jellyfin backend, if you go to an artist page and select "Play Artist Station" it works as expected. But if you then go to a different artist page and select "Play Artist Station" it doesn't load in the new station.

Quitting Supersonic and selecting "Play Artist Station" for the second artist works as expected.

dweymouth commented 10 months ago

Edit for visibility: This is fixed on main for 0.8.1

That's so weird! Just confirmed it, but all I'm doing is calling Jellyfin's Instant Mix API with the album ID of one of the artist's albums. I wonder if for some reason Jellyfin isn't creating a fresh Instant Mix? This might be a tough one to track down..

adamshand commented 10 months ago

Wondered if it might be a Jellyfin bug, though confusing why restarting Supersonic fixes it ...

dweymouth commented 10 months ago

Well restarting will establish a new authentication with the Jellyfin server so it could still clear out somethign on the Jellyfin end too. There's definitely no state I'm keeping on my side that would cause this. Either I'm not using the API right or there's a bug on Jellyfin's side

adamshand commented 10 months ago

I'm no good at GoLang, but I could try a minimal JS repro ... is that useful?

dweymouth commented 10 months ago

Yeah, if you could get it to repro (or not) in JS that would be helpful to track what's going on. For best maintainability I made an adapter layer that presents the same API to the UI layer regardless of the backend, and for Subsonic, playArtistRadio(artistID) just calls getSimilarSongs on the server with the artist ID. For Jellyfin, the documentation says the InstanctMix API only works with album IDs, so I first get an album by that artist with an API call on /Users/<jfUserID>/Items, with a filter of ItemType=album and ArtistID=< artistID > and Limit=1. Then call /Items/<albumID>/InstantMix to actually get the song list. What I wonder is if there was some Reset call or parameter you're supposed to set to communicate that you want a new InstantMix, and not the same collection of songs

https://api.jellyfin.org/#tag/InstantMix

adamshand commented 10 months ago

Was just seeing if I could repo it inside the Jellyfin app itself.

Interestingly, I get wildly different results. I have a not very well known New Zealand artist called "Chris Knox". On Supersonic, I get a very limited set of artists returned (basically just the one album plus a tribute album). If I hit "Instant Mix" on "Chris Knox" in the Jellyfin web UI, I get a whole assortment of NZ artists.

dweymouth commented 10 months ago

I wonder if the API documentation is incorrect that it only works for albums and I'd get a broader set of results just using the artistID directly as the seed. I can try that on my library as well - not sure it'll solve the repeated InstantMix issue but maybe it will give better results on the first call.

dweymouth commented 10 months ago

OK, I'm stupid... there's an /Albums/<id>/InstantMix and an /Artists/<id>/InstantMix. Still not sure if this will solve the issue but at least avoids the whole "get an album just so we can have an albumID" thing

dweymouth commented 9 months ago

Fixed in 0.8.1