op / go-libspotify

Language bindings for libspotify in Go (Golang)
Apache License 2.0
64 stars 13 forks source link

Panic when Playlist(int) is a PlaylistTypeStartFolder #16

Open fabiofalci opened 9 years ago

fabiofalci commented 9 years ago

Hi,

The library throws a panic when playlist is not PlaylistTypePlaylist or PlaylistTypePlaceholder.

https://github.com/op/go-libspotify/blob/master/spotify/libspotify.go#L1411

So it doesn't support PlaylistTypeStartFolder/PlaylistTypeEndFolder.

Is that designed or was just not investigated enough in how process PlaylistTypeStartFolder/PlaylistTypeEndFolder?

My issue if you want to look at it: https://github.com/fabiofalci/sconsify/issues/5

op commented 9 years ago

Hi! I don't quite remember what my thoughts were for folders but it does look like I did (try to) add support for folders. If you determine the type by calling PlaylistType and for each folder you call Folder on that index.

I'm very open for suggestions on how to improve this.

fabiofalci commented 9 years ago

Ok! Nice one, I can check the type before. So I've included a fix for this: https://github.com/fabiofalci/sconsify/commit/1e03c6895f8d9049eae07b01a2c57fe1b023548c

It fixes my issue for now.

Eventually I'll want to include a more complete support for Folder, like group the playlists together, but for now it's enough.

So feel free to close this if you want.