Burgestrand / Hallon

Hallon is currently **UNMAINTAINED**.
http://rdoc.info/github/Burgestrand/Hallon/master/frames
134 stars 12 forks source link

New playlists don't appear on the desktop client #151

Open rilla opened 11 years ago

rilla commented 11 years ago

For this code:

container = Hallon::Session.instance.container.load
playlist = container.add "Test"
container.move(container.size-1, 0)
playlist.insert(0, track_array)
playlist.upload(30)

The behavior is unpredictable: sometimes new playlists appear on the desktop client immediately but sometimes they don't. Sometimes they appear after relogin on the desktop client, but that doesn't work consistently either.

I'm using libspotify 12.1.51.3 and hallon 0.18.2. Maybe it's something with my implementation, but I can't find a complete example on creating and updating playlists so I had to guess - and it might have been a wrong guess.

Burgestrand commented 11 years ago

The Playlist#upload method is a bit spotty at best, unfortunately, and it does not really do anything apart from wait.

libspotify is the main workhorse, and while your application is running (and Session#process_events is being called), libspotify does work to synchronize the spotify servers and the local data. This can happen at any time, or never, depending entirely on what libspotify decides to do.

In general, libspotify is not suitable for one-off tasks. It is written with the intention that the application using it will be long-running, so it has time to update the spotify servers when it needs to. There is no way to flush data to the spotify servers in libspotify; sometimes triggering a logout will do that, but the behaviour is not consistent.

I’m afraid I can’t help much with this issue.