Open will-ca opened 1 year ago
I'm interested in working on this.
Ok, I assigned you. Before committing time and effort, please share a general outline of your approach to this. I suggest this should be an option available in the settings, and persisted somewhere in the config folder, perhaps as a separate json, but no necessarily.
So My plan is more or less to
I don't really know if there's any setup function which I could hook into.
I'm thinking that the easiest way is to save the entier queue to the config file. However, I don't really know where to do this. I'm guessing the best place is in the queue actions file?
I also don't know if there's a neat way of removing the song that was just played, but I'm sure ill find a way to do it. It can't be that difficult, right?
If you search by store.get
, you can see a bunch of instances where elements of the config are loaded. packages/core/src/persistence/store.js
contains the helper functions for managing the store. You can either use this, or better yet, use the electron-store
library to keep the saved queue in a separate file (so if it's big it doesn't slow down other functions of the player). Then, at startup, for example when the queue container is loaded for the first time, you can load the tracks.
Similarly, store.set
lets you save the config. Look for the buildElectronStoreState
function to see how it can be mocked and tested.
packages/app/app/store/enhancers/syncStorage.js
contains code that subscribes to the redux store and syncs settings with the config file. You can use a similar mechanism. While some of those files are still javascript we want all new code to be written in Typescript.
Thanks for discussing this, it's important that we're on the same page so that there's no wasted effort on either side.
When a song ends, remove it from the config
Does this behaviour reflect how the queue is actually stored in the app and exposed in the UI?
The queue is stored in redux. You can listen to the changes to reflect them in the persisted state.
@nukeop what about storing queue in localStorage of the browser?
Yeah that could work as well. I prefer to keep everything in one place, but if anyone wants to implement it differently that's fine.
Yeah that could work as well. I prefer to keep everything in one place, but if anyone wants to implement it differently that's fine.
Can I give this a try @nukeop ?
Not sure if the previous contributor is still working on it. You can give it a shot.
If you close and re-open Nuclear, your play queue is gone, and you lose your place.
Not maintaining that state is annoying for E.G. recovering from crashes, working around bugs by restarting, etc. Most music players have an option to save and restore the play queue on exit and re-launch.