From 503a37ba4d7550f9c2ed1602e589a0142a20d10d Mon Sep 17 00:00:00 2001 From: Florrie Date: Fri, 10 Jul 2020 11:28:34 -0300 Subject: basic working backend save/restore & socket server Backend save/restore code (living in serialized-backend.js) has been well tested and shouldn't need much change going forward. Now we get to begin working on the actual synchronized-over-socket-server commands! --- ui.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'ui.js') diff --git a/ui.js b/ui.js index de0b214..1e48877 100644 --- a/ui.js +++ b/ui.js @@ -31,6 +31,11 @@ const { shuffleOrderOfGroups } = require('./playlist-utils') +const { + updateRestoredTracksUsingPlaylists, + getWaitingTrackData +} = require('./serialized-backend') + const { ui: { Dialog, @@ -189,6 +194,8 @@ class AppElement extends FocusElement { this.isPartyHost = false this.enableAutoDJ = false + this.playlistSources = [] + this.config = Object.assign({ canControlPlayback: true, canControlQueue: true, @@ -1124,6 +1131,9 @@ class AppElement extends FocusElement { grouplike = await processSmartPlaylist(grouplike) + this.playlistSources.push(grouplike) + updateRestoredTracksUsingPlaylists(this.backend, this.playlistSources) + if (!this.tabber.currentElement || newTab && this.tabber.currentElement.grouplike) { const grouplikeListing = this.newGrouplikeListing() grouplikeListing.loadGrouplike(grouplike) @@ -3379,6 +3389,7 @@ class PlaybackInfoElement extends FocusElement { refreshTrackText(maxNameWidth = Infinity) { const { playingTrack } = this.queuePlayer + const waitingTrackData = getWaitingTrackData(this.queuePlayer) if (playingTrack) { this.currentTrack = playingTrack const { name } = playingTrack @@ -3390,6 +3401,11 @@ class PlaybackInfoElement extends FocusElement { this.progressBarLabel.text = '' this.progressTextLabel.text = '(Starting..)' this.timeData = {} + } else if (waitingTrackData) { + const { name } = waitingTrackData + this.clearInfoText() + this.trackNameLabel.text = name + this.progressTextLabel.text = '(Waiting to play, once found in playlist source.)' } else { this.clearInfoText() } -- cgit 1.3.0-6-gf8a5