From 90cad535c470fffa5c34c48737e44c1641416f0d 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 b784688..dd1123b 100644 --- a/ui.js +++ b/ui.js @@ -49,6 +49,11 @@ import { shuffleOrderOfGroups, } from './playlist-utils.js' +import { + updateRestoredTracksUsingPlaylists, + getWaitingTrackData +} from './serialized-backend.js' + /* text editor features disabled because theyre very much incomplete and havent * gotten much use from me or anyonea afaik! const TuiTextEditor = require('tui-text-editor') @@ -179,6 +184,8 @@ export default class AppElement extends FocusElement { this.isPartyHost = false this.enableAutoDJ = false + this.playlistSources = [] + this.config = Object.assign({ canControlPlayback: true, canControlQueue: true, @@ -1588,6 +1595,9 @@ export default 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) @@ -4430,6 +4440,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 @@ -4441,6 +4452,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