diff options
Diffstat (limited to 'socket.js')
-rw-r--r-- | socket.js | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/socket.js b/socket.js index b9e4ccf..33269ee 100644 --- a/socket.js +++ b/socket.js @@ -496,9 +496,7 @@ export function makeSocketClient() { return client } -export function attachBackendToSocketClient(backend, client, { - getPlaylistSources -}) { +export function attachBackendToSocketClient(backend, client) { // All actual logic for instances of the mtui backend interacting with each // other through commands lives here. @@ -512,6 +510,9 @@ export 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) @@ -644,8 +645,6 @@ export 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'}) @@ -902,6 +901,8 @@ export function attachBackendToSocketClient(backend, client, { partyGrouplike.items.push(deserialized) backend.partyGrouplikeUpdated(client.socketId, partyGrouplike) + updateRestoredTracksUsingPlaylists(backend, getPlaylistSources()) + client.sendCommand({ code: 'share-with-party', item: serialized |