Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
help with functions
11-05-2013, 09:27 AM
Post: #1
help with functions
Hi - I've been looking through the spotify sharp functions etc and I'm trying to familiarise myself with these currently... however, I am not getting very far.

Is it possible you could give me an example of how to create a play list? Or at least, get access to the playlist function?

I've tried

var playlist = new SpotifySharp.Playlist();

but it doesn't like that.

I'm simply trying to get a list of playlists for the logged in user, then I want to create part of the form to allow creation of a new playlist. I then want to search and add tracks. A long way to go yet!!

Thanks for any help!
Find all posts by this user
13-05-2013, 08:28 AM (This post was last modified: 13-05-2013 09:01 AM by andreww.)
Post: #2
RE: help with functions
First of all, you can get a PlaylistContainer by calling Playlistcontainer() on your SpotifySession object. It might not be loaded yet, so use IsLoaded() to check. If you need to wait for the PlaylistContainer to load, you can use AddCallbacks to register callbacks. Once it's loaded, you can use the methods NumPlaylists, Playlist, PlaylistType, PlaylistFolderName and PlaylistFolderId to inspect the playlists. Note that Spotify uses a slightly odd mechanism to tell you about playlist folders. If you have this structure:

+--Playlist A
+--Playlist B
+--Folder X
|  +--Playlist C
|  \--Playlist D
+--Playlist E
\--Folder Y
   \--Playlist F

Spotify will represent this as 10 'playlists':
0. Playlist A
1. Playlist B
2. Start of folder X
3. Playlist C
4. Playlist D
5. End of folder X
6. Playlist E
7. Start of folder Y
8. Playlist F
9. End of folder Y

The PlaylistType is used to distinguish actual playlists from markers indicating the start and end of folders.

Creating a playlist in a PlaylistContainer is done with AddNewPlaylist(). That will return you a playlist to which you can add and remove tracks.
Visit this user's website Find all posts by this user

Forum Jump: