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

inboxPlaylist WIP. Works, but incorrectly follows the User.starredPlaylist pattern. Should be on PlaylistContainer instead?

Open nzoschke opened this issue 11 years ago • 4 comments

I will need some help landing this one. I'm not a C++ pro, yet.

I would like to gain access to the session user inbox playlist via sp_session_inbox_create. Copying the way that sp_session_starred_for_user_create turns into the starredPlaylist accessor was the easiest for me.

I know that casting it to a StarredPlaylist isn't correct, nor is having it on User, when it only makes sense for a session user.

nzoschke avatar Jun 21 '14 18:06 nzoschke

I guess since this is only tied to the session the best way to put it would be just `spotify.inboxPlaylist'. User does not make sense since it would be the same for all users.

Instead of StarredPlaylist a completely new Playlist subtype should be created

class InboxPlaylist : public Playlist {
public:
  InboxPlaylist(sp_playlist* playlist) : Playlist(playlist) {}
  std::string name() { return "Inbox"; }
}

Furthermore, I guess you can't add tracks to an InboxPlaylist, so maybe it would be good to overwrite playlist.addTracks() to just throw an exception. But maybe this even works with the existing error handling.

FrontierPsychiatrist avatar Jun 22 '14 09:06 FrontierPsychiatrist

It looks like you can add tracks to the inbox playlist just like any other playlist! But they don't show up in the UI, so you need to delete them programmatically. You can argue that you shouldn't but I'm not sure it needs to throw an exception...

nzoschke avatar Jul 02 '14 22:07 nzoschke

Updated the patch. Now correctly implements InboxPlaylist class accessible through the Spotify object.

nzoschke avatar Jul 02 '14 22:07 nzoschke

Hi! I hope next week I will be able to look at this (and finish 0.7.0...).

FrontierPsychiatrist avatar Jul 09 '14 21:07 FrontierPsychiatrist