-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Last.fm API no longer returning now playing track for user.getRecentTracks #78
Comments
Need to investigate alternatives for this |
API seems to have changed behaviour - page=1 no longer contains "now playing" track as its first item - page=0 no longer returns same as page=1 but without the "now playing" track See #78
API seems to have changed behaviour - page=1 no longer contains "now playing" track as its first item - page=0 no longer returns same as page=1 but without the "now playing" track See #78
According to last.fm api pages "now playing" is now showed by passing a parameter in the call to GetRecentTracks.
I'll add support for this. |
I did some testing of the Last.fm api for this. It seems that the "now playing" track is always returned regardless of if you send the nowplaying="true" parameter to the api or not. Example on return dataset from calling the User.getRecentTracks without adding the nowplaying parameter:
So the "now playing" track is returned. There is a value in the @attr for marking that it is the now playing song. I made a unit test to check that the existing code handles this response correctly. It does. Will make a PR with the unit test. With the current behaviour of the last.fm api I think this issue can be closed. |
Thanks for looking into this @klinge - I think this behaviour has changed a bit over the last few months, so it might be worth adding an integration test? One that'll fail if the API behaviour changes. |
Integration testing would sort of require that you had a user that you knew always had a song playing. Otherwise you will not get the "nowplaying" attribute. The "RJ" user does not have that. If you can think of a good way to do an integration test I'd be happy to implement it :) |
I just realised that the integration test for track.updateNowPlaying (what this issue is about) is exactly the same test as I'm suggesting you write - so no extra test needed :) For future ref though, the base class for the integration tests authenticates with the user |
Never used or looked at the scrobble functions in the library. Will have to do that sometime.. :) Should I still make a PR for the added unit test I made for the "nowplaying" attribute in the user.getrecenttracks command? (it's just one added test and a json resource file.. ) |
I can reproduce the response from the original post. I want to receive the currently playing song. But recent tracks doesn't deliver that, Page 0 is out of bounds. Page 1 doesn't contain it. Is there any endpoint that provides me the currently played track? |
Integration test
TrackUpdateNowPlayingCommandTests.UpdatesNowPlaying
is failing.API takes a parameter called
page
. Behaviour of API used to be that whenpage=1
, the response would be the same aspage=0
prepended with the "now playing" track.For
page=0
, the API now responds with:And
page=1
does not contain the "now playing" track.The text was updated successfully, but these errors were encountered: