spotify-player icon indicating copy to clipboard operation
spotify-player copied to clipboard

When playing songs from Liked songs page: Cannot determine the current page's context

Open wiraki opened this issue 4 months ago • 5 comments

Describe the bug When I first go to Liked Songs (g y) and start playing songs, if I navigate away (for example going to Artist page of the current song) and then use g Space to go back to current context, it fails to do bring me back to Liked Songs and says Cannot determine the current page's context

To Reproduce See description.

Expected behaviour I would expect g Space to bring me back to Liked Songs. Let me know if what I am seeing is the normal expected behavior.

Log and backtrace

Let me know if a log is necessary (by the way, doesn't it include confidential tokens etc.?)

Backtrace is empty.

Environment

  • OS: Pop!_OS 22.04 LTS x86_64
  • Application version: 0.21.0 -> Built from commit 77af13b48b2a03e61fef1cffea899929057551dc
  • Application features: streaming,media-control,pulseaudio-backend,image,notify,fzf

wiraki avatar Sep 04 '25 20:09 wiraki

I would expect g Space to bring me back to Liked Songs. Let me know if what I am seeing is the normal expected behavior.

this is expected cause when you play from the Liked Tracks page, it just creates a tracks playback consisting of a subset of tracks there. g space only supports context playback, i.e. when you play from playlist/album

aome510 avatar Sep 05 '25 19:09 aome510

Thanks for the fast reply!

it just creates a tracks playback consisting of a subset of tracks there.

I was not aware of that. Do I understand correctly that if I have liked e.g. 500 tracks, when I start playback from the Liked Tracks page it creates a subset of X tracks?

If that is correct:

  • How is the number of tracks in the subset determined?
  • Is this how the official client function and I never noticed?

I am sorry if this is documented somewhere, I tried to find it but I may have missed it. Feel free to just point me in the right direction.

wiraki avatar Sep 05 '25 22:09 wiraki

I was not aware of that. Do I understand correctly that if I have liked e.g. 500 tracks, when I start playback from the Liked Tracks page it creates a subset of X tracks?

Yes and it depends on the song that you start the playback with. The logic is defined in https://github.com/aome510/spotify-player/blob/77af13b48b2a03e61fef1cffea899929057551dc/spotify_player/src/state/model.rs#L709-L719

in case you're interested. tldr, it will pick tracks_playback_limit (default 50) songs around the start track to initiate the playback. If you increase this number too high, Spotify API will return an error.

Is this how the official client function and I never noticed?

I'm not sure. If I start a liked tracks playback using official Spotify app, got this as a returned context

> spotify_player get key playback | jq .context
{
  "uri": "spotify:user:31bewedqaetpovv3yqnw44jtphsy:collection",
  "href": "https://api.spotify.com/v1/me/tracks",
  "external_urls": {
    "spotify": "https://open.spotify.com/collection/tracks"
  },
  "type": "collection"
}

and it seems I can also use spotify:user:31bewedqaetpovv3yqnw44jtphsy:collection as a context_uri to start a playback in https://developer.spotify.com/documentation/web-api/reference/start-a-users-playback 🤔 even Spotify says it only supports artist/playlist/album as a context:

Image

Obviously, rspotify only allows to use artist/playlist/album as a context: https://docs.rs/rspotify/latest/rspotify/clients/trait.OAuthClient.html#method.start_context_playback

That said, I think it's definitely possible implement something in spotify_player to support liked tracks as a context

aome510 avatar Sep 06 '25 01:09 aome510

That said, I think it's definitely possible implement something in spotify_player to support liked tracks as a context

fwiw, I do plan to improve the usability of tracks context in spotify_player (so that tracks playback will show up in currently playing context page) so this liked-tracks integration will probably be included as part of the work

aome510 avatar Sep 06 '25 01:09 aome510

Thanks for the details aome510, TIL !

I leave it up to you whether to close this issue or leave it open for future implementation.

wiraki avatar Sep 06 '25 10:09 wiraki