Skip to content
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

Question: How to start playing "Liked Songs" #380

Open
supersej opened this issue Feb 28, 2023 · 7 comments
Open

Question: How to start playing "Liked Songs" #380

supersej opened this issue Feb 28, 2023 · 7 comments
Assignees
Labels
enhancement New feature or request v5 Will be worked on in v5

Comments

@supersej
Copy link

I have a question I cant seem to find an answer for. At least not with my google skills.

I would like to start playing my Spotify "Liked Songs" via Spotcast on Homeassistant, but can't seem to figure out how (if Spotcast do support this feature).

From the Spotify web player I would open
https://open.spotify.com/collection/tracks

The official Spotify API has a call for it
https://developer.spotify.com/documentation/web-api/reference/#/operations/get-users-saved-albums

For Mopidy it seems like they found a solution to play the collection
mopidy/mopidy-spotify#313

I've tried using
spotify:your:tracks
and spotify:playlist:tracks
but with no luck

Could you please point me in the right direction :)

Best regards Daniel

@supersej supersej added the bug Something isn't working label Feb 28, 2023
@fcusson
Copy link
Collaborator

fcusson commented Feb 28, 2023

Saddly, liked songs is not a playlist in the normal sense of Spotify. And because of that, it lacks a URI. The current way spotcast handles media playback is purely based on uri (even the search function is just a wrapper to get a uri based on the search results).

I looked into the /me/playlist and there is no mention of the liked songs in it. So even from an API endpoint it doesn't seems to be exposed.

@fcusson fcusson added enhancement New feature or request dependency issue issue exist because of dependency not the project itself and removed bug Something isn't working labels Feb 28, 2023
@supersej
Copy link
Author

supersej commented Mar 1, 2023

Thanks for the fast answer. Even though I was hoping that there was a way.

Have you got any idea how they solved it in Mopidy then?
Is that something that can maybe be ported to Spotcast?

@fcusson
Copy link
Collaborator

fcusson commented Mar 2, 2023

oh god, it seems it's actually something that can be done, just that the endpoint is not user friendly. That would require some extensive changes to spotcast, but basically:

current_user_saved_tracks will return a list of uri from the liked song playlist. Sincve its not a playlist uri, we would need to start media playback on the first song and then use add_to_queue for the rest of the songs.

That should work and is probably what mopidy does, because the only way to access songs in the liked songs "playlist" is on a per song basis.

To go even further, we would probably need a logic to fetch song with a certain number limit and then offset and repeat until we have the full playlist. We could always limit the number of songs, but with the non-organisable nature of the liked songs "playlist" it wouldn't be a great UX.

@supersej
Copy link
Author

supersej commented Mar 3, 2023

Wow kudos for the great job of actually figure out how it is done.

That would also explain why "liked songs" is not like other Playlist, because well it's just a big pile of songs queued together.

And yes I can imagine that it would be challenging when the list of liked songs contains hundreds or thousands of song, that the add to queue needs to be split up and maybe even include a delay.

Is there any way to see In the list when a song has been liked?
Because if not, theoretical the songs could be played random every time? Unless the pull of songs is listed by when added.

Really great job so far 👍 😉

@taciturnaxolotl
Copy link

taciturnaxolotl commented Oct 17, 2023

Use {user_uri}:collection as the URI.

@taciturnaxolotl
Copy link

Replace {user_uri} with the URI you get when you go to your profile in the Spotify desktop app and try to share a link to your profile but hold ctrl or option when pressing copy link to profile.

@fcusson fcusson added v5 Will be worked on in v5 and removed dependency issue issue exist because of dependency not the project itself labels Dec 5, 2024
@fcusson
Copy link
Collaborator

fcusson commented Dec 5, 2024

functionality working in beta

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request v5 Will be worked on in v5
Projects
None yet
Development

No branches or pull requests

3 participants