feat: restore the queue and position after a restart
Quitting, a crash or SteamOS restarting the app lost the queue and how far into the track playback was, which hurts most for long items. The queue is now saved to queue.json in the state directory, one queue per user and server, on a track change, on pause, when songs are queued, every 15 seconds while playing and on quit. It holds song metadata, never a stream URL, since those carry the token or the password. On start the saved track is loaded paused and seeked to once it has prerolled. Nothing plays, and the server is not told about the track, until play is pressed. An unreadable file is logged and ignored. Two player bugs had to go for this. A failing source posts several errors, and the later ones counted against the next track, so one missing song skipped two tracks or stopped the queue. Play pressed while a track was still loading was dropped.
This commit is contained in:
@@ -60,13 +60,13 @@ test-live: ## Every Subsonic call against a real server (DEMO_URL, DEMO_USER, DE
|
||||
|
||||
.PHONY: shots
|
||||
shots: ## Screenshot the main screens against the demo server into target/shots
|
||||
@mkdir -p $(SHOTS_DIR) $(SCRATCH)/config/remus $(SCRATCH)/cache
|
||||
@mkdir -p $(SHOTS_DIR) $(SCRATCH)/config/remus $(SCRATCH)/cache $(SCRATCH)/state
|
||||
@salt=$$(head -c 8 /dev/urandom | od -An -tx1 | tr -d ' \n'); \
|
||||
token=$$(printf '%s%s' '$(DEMO_PASS)' "$$salt" | md5sum | cut -d' ' -f1); \
|
||||
printf 'url = "%s"\nusername = "%s"\nsalt = "%s"\ntoken = "%s"\n' \
|
||||
'$(DEMO_URL)' '$(DEMO_USER)' "$$salt" "$$token" > $(SCRATCH)/config/remus/config.toml
|
||||
cargo build
|
||||
XDG_CONFIG_HOME=$(CURDIR)/$(SCRATCH)/config XDG_CACHE_HOME=$(CURDIR)/$(SCRATCH)/cache \
|
||||
XDG_CONFIG_HOME=$(CURDIR)/$(SCRATCH)/config XDG_CACHE_HOME=$(CURDIR)/$(SCRATCH)/cache XDG_STATE_HOME=$(CURDIR)/$(SCRATCH)/state \
|
||||
REMUS_DEV_SCRIPT="wait:4000,shot:$(SHOTS_DIR)/home.png,right,activate,wait:3000,shot:$(SHOTS_DIR)/album.png,down,activate,wait:3000,now-playing,wait:2500,shot:$(SHOTS_DIR)/now-playing.png,play-pause,back,section-next,section-next,section-next,wait:3000,shot:$(SHOTS_DIR)/artists.png,quit" \
|
||||
./target/debug/remus
|
||||
|
||||
|
||||
Reference in New Issue
Block a user