« get me outta code hell

basic working backend save/restore & socket server - mtui - Music Text User Interface - user-friendly command line music player
about summary refs log tree commit diff
path: root/ui.js
diff options
context:
space:
mode:
authorFlorrie <towerofnix@gmail.com>2020-07-10 11:28:34 -0300
committer(quasar) nebula <qznebula@protonmail.com>2024-05-16 18:37:00 -0300
commit90cad535c470fffa5c34c48737e44c1641416f0d (patch)
tree6b46582ea6d4a5585065d3a50ad3805ed047a4fb /ui.js
parent3f17023373f3fa26ccb556ab1f83215b2a134e8c (diff)
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!
Diffstat (limited to 'ui.js')
-rw-r--r--ui.js16
1 files changed, 16 insertions, 0 deletions
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()
     }