diff options
author | (quasar) nebula <towerofnix@gmail.com> | 2021-04-25 18:59:06 -0300 |
---|---|---|
committer | (quasar) nebula <towerofnix@gmail.com> | 2021-04-25 18:59:06 -0300 |
commit | f0874e35653b50aa59b362fa8c8d9bd7ab6e416a (patch) | |
tree | f22de7421deeabc2b1b5090f7ff1c705399f7ebe | |
parent | 00cd029ca0ac311f4c2509befb50d02b43de2c00 (diff) |
playlist sources = only what's shared with party
-rwxr-xr-x | index.js | 4 | ||||
-rw-r--r-- | socket.js | 11 | ||||
-rw-r--r-- | ui.js | 6 |
3 files changed, 10 insertions, 11 deletions
diff --git a/index.js b/index.js index 394a859..3ecd59b 100755 --- a/index.js +++ b/index.js @@ -171,9 +171,7 @@ async function main() { } if (socketClient) { - attachBackendToSocketClient(backend, socketClient, { - getPlaylistSources: () => appElement.playlistSources - }) + attachBackendToSocketClient(backend, socketClient) let nickname = process.env.USER if (options['socket-name']) { diff --git a/socket.js b/socket.js index 2890efb..7760334 100644 --- a/socket.js +++ b/socket.js @@ -503,9 +503,7 @@ function makeSocketClient() { return client } -function attachBackendToSocketClient(backend, client, { - getPlaylistSources -}) { +function attachBackendToSocketClient(backend, client) { // All actual logic for instances of the mtui backend interacting with each // other through commands lives here. @@ -519,6 +517,9 @@ function attachBackendToSocketClient(backend, client, { const partyGrouplikeMap = Object.create(null) + const getPlaylistSources = () => + partyGrouplike.items.map(item => item[originalSymbol]) + backend.setHasAnnouncedJoin(false) backend.setAlwaysStartPaused(true) backend.setWaitWhenDonePlaying(true) @@ -651,8 +652,6 @@ function attachBackendToSocketClient(backend, client, { return case 'initialize-backend': await restoreBackend(backend, command.backend) - // TODO: does this need to be called here? - updateRestoredTracksUsingPlaylists(backend, getPlaylistSources()) backend.on('playing', QP => { QP.once('received time data', () => { client.sendCommand({code: 'status', status: 'sync-playback'}) @@ -909,6 +908,8 @@ function attachBackendToSocketClient(backend, client, { partyGrouplike.items.push(deserialized) backend.partyGrouplikeUpdated(client.socketId, partyGrouplike) + updateRestoredTracksUsingPlaylists(backend, getPlaylistSources()) + client.sendCommand({ code: 'share-with-party', item: serialized diff --git a/ui.js b/ui.js index aaf776c..38a365d 100644 --- a/ui.js +++ b/ui.js @@ -196,7 +196,7 @@ class AppElement extends FocusElement { this.isPartyHost = false this.enableAutoDJ = false - this.playlistSources = [] + // this.playlistSources = [] this.config = Object.assign({ canControlPlayback: true, @@ -1274,8 +1274,8 @@ class AppElement extends FocusElement { grouplike = await processSmartPlaylist(grouplike) - this.playlistSources.push(grouplike) - updateRestoredTracksUsingPlaylists(this.backend, this.playlistSources) + // this.playlistSources.push(grouplike) + // updateRestoredTracksUsingPlaylists(this.backend, this.playlistSources) if (!this.tabber.currentElement || newTab && this.tabber.currentElement.grouplike) { const grouplikeListing = this.newGrouplikeListing() |