psst icon indicating copy to clipboard operation
psst copied to clipboard

Restore state from where the program stopped last time (autoplay track/playlist)

Open pythonhacker opened this issue 4 years ago • 6 comments

If I stopped psst when I was playing a track, I would like it to auto-play the same track when I restart psst. Similar to saving volumne and other parameters, can we save the most recently played track in config and restore that state once the program is relaunched ?

Let me know if this makes sense. I will be happy to implement this.

pythonhacker avatar Aug 19 '21 15:08 pythonhacker

This is definitely wanted. I'd like to as well save and restore the current route. I will eventually get to it, but in case you'd like to tackle this yourself, I'm happy to assist.

jpochyla avatar Aug 20 '21 10:08 jpochyla

After looking into this issue, it looks to me like you can't easily intercept the QUIT_APP command because it is handled by druid.

It seems like the delegate's command handler https://github.com/jpochyla/psst/blob/7c2152d559411c197536a65b484ab67672bc4725/psst-gui/src/delegate.rs#L53 doesn't receive that command. (In fact, I also tried adding the event() function and couldn't even get any of the close-window events.)

Is there a way to execute some code when the application is quit?

JuliDi avatar Aug 21 '21 12:08 JuliDi

I think we can re-save the config after every route change.

jpochyla avatar Aug 24 '21 10:08 jpochyla

So would the route or the playback be serialized and saved to file?

JuliDi avatar Aug 24 '21 10:08 JuliDi

Current route is now stored in config and restored on startup as of 6c31eb3.

jpochyla avatar Aug 28 '21 10:08 jpochyla

I noticed that the route is saved and restored (e.g. the playlist page), but I would also like it to save/restore the currently playing song. When I quit and reopen Psst, I would like it to bring up the previous song in the paused state, so I can hit space bar to continue playing. (This is how the official Spotify client works.) Would that be difficult to add?

ndbroadbent avatar Aug 30 '23 01:08 ndbroadbent