Closed deiga closed 12 years ago
Track loading in playlists it’s a very strange beast. When the playlist is loaded, the tracks are not necessarily loaded (as far as I know). libspotify’s example code will look at the playlist when it is loaded, and if not all tracks are loaded it will wait for the metadata callback and try later.
For Hallon, you’d load the playlist and then you retrieve all tracks you are interested in with playlist.tracks[]
or playlist.tracks.to_a
for all. Once that is done you’ll need to iterate through the tracks and wait for them to load. However, looping through the tracks with playlist.tracks.each { |track| track.load }
is a bad idea, as that is likely to take quite a long while if you have many tracks since libspotify can only load one track at a time instead of them all at once.
I’ve updated hallon-heroku to show playlists and their contents, as well as showing published playlists for users, in case you are interested on how one might do have a look at the playlist route: https://github.com/Burgestrand/hallon-heroku/blob/7f8b93fda5b280ddd09a87bfecfd3024fe05f49e/app.rb#L154
In the future, for questions, please ask on the mailing list instead: ruby-hallon@googlegroups.com (https://groups.google.com/d/forum/ruby-hallon). I’d like to keep the Hallon issue tracker clean from everything that are not bugs or call-to-action things about the development on Hallon, thank you. :)
Hey,
I've got my software which displays playlist information deployed on Heroku. Locally it works great, but the deployed version has some problems.
I currently load playlist tracks and then display all of them, checking for each that it is loaded. Locally it's blazingly fast but on heroku it crashes the request. When I disable waiting for loaded tracks, then most of my track names are just empty strings :(
Do you have any pointers for this?
I know this is more an issue with libspotify than hallon, but I thought you might be able to help anyway :)