Hi! I won’t have enough time with my computer to write you a full reply today, so here’s the short points.
- Hallon’s API is spotty at best. I don’t like the direction Hallon’s been taking, so I’ve been working (on paper) on a better, opinionated API for Hallon.
- As a result of the above point, I’ve also been working on moving a lot of the low level stuff in Hallon towards the Spotify gem. Once done, I hope Hallon will be much more clear in how to do things (and also more clear in that certain things are not meant to be done with Hallon), and Spotify will be much more painless to use to fill in the gaps if necessary.
- Your issue is mainly a symptom of both the above points, but the real reason is that the API was not written to make writing to playlist containers or folders easy, only reading. Excluding good write support is not something I deliberately did, it is simply something I never considered when writing the implementation.
- Playlist containers in libspotify are _flat_. The playlist entries are simply playlists, but folders are nothing but markers with a start marker and an ending marker. This is why the folders have a beginning index and an end index. When you read the contents of a playlist container on a folder marker (either the beginning one, or the ending one), Hallon will search upwards or downwards for the other marker (either beginning, or end), and give you a folder back with those indices. This is why you will receive two identical folder entries for each folder when reading the playlist container.
However, with the above said, there’s nothing hindering giving a folder the ability to insert playlists and folders into itself. It has a reference back to the playlist container, and it’s own start/stop indices. You’re very welcome to create an issue on Hallon with this, and I’ll tag it as a feature request to make it happen. :)
PS: You are of course very welcome to try and write your own solution and submit a pull request and I’ll merge it in!
PPS: Sorry about the brevity in my response, most of my day today will be spent off the computer and I’m a bit low on time already. :)
— Kim