Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Getting a playlist's id/href

0 views
Skip to first unread message

Aurélien Malisart

unread,
Jan 10, 2013, 10:29:41 AM1/10/13
to ruby-...@googlegroups.com

Hello,

I can't figure out how to get a playlist's href.

I am successfully able to create a playlist with container.add and I get a Hallo::Playlist instance. I then upload it, and I can see it on Spotify. But how can I get from this instance the href/url/id to store it on our side ? I can't find the method to use :-p

Thanks in advance,

Aurels

Kim Burgestrand

unread,
Jan 10, 2013, 12:34:49 PM1/10/13
to Hallon on behalf of Aurélien Malisart
All objects that can be linked to have a #to_link method:

#to_link will return a Link object, which is the same as a Link in libspotify as well:

Links have two interesting methods for you, #to_uri and #to_url:

The URI is the Spotify URI, e.g. spotify:user:something:playlist, and URL is the
HTTP URL, e.g. http://open.spotify.com/

It all maps pretty much 1-1 to the libspotify API, so if in doubt you can always
see what objects have which methods.

— Kim

--
You received this message because you are subscribed to the Hallon ruby gem mailing list.

- To view this group online, visit https://groups.google.com/d/forum/ruby-hallon
- To post to this group, send email to ruby-...@googlegroups.com
- To unsubscribe from this group, send email to ruby-hallon...@googlegroups.com
 
 

Aurélien Malisart

unread,
Jan 11, 2013, 6:11:38 AM1/11/13
to ruby-...@googlegroups.com
Hi Kim,

Thank you, that was exactly what I was looking for (the URI).  So `playlist.to_link.to_uri` does the job.

Cheers,

Aurélien

Kim Burgestrand

unread,
Jan 11, 2013, 1:51:18 PM1/11/13
to Hallon on behalf of Aurélien Malisart
On Friday, 11 January 2013 at 12:11, Aurélien Malisart via Hallon wrote:
Thank you, that was exactly what I was looking for (the URI).  So `playlist.to_link.to_uri` does the job.
Sweet! For the URI, you should also be able to do just "playlist.to_str" — I believe I’ve made it
so that all objects that are linkable have their to_str method return their URI (since every object
can be represented as a string).

— Kim 
Reply all
Reply to author
Forward
0 new messages