From 9b9707a9786abd66bd8523a7191ae09cd2811df6 Mon Sep 17 00:00:00 2001 From: Etoh Date: Thu, 23 Feb 2023 19:27:15 +0000 Subject: [PATCH] Restore server-side playlist on reconnect (#567) --- syncplay/client.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/syncplay/client.py b/syncplay/client.py index 0ec266e..262686d 100755 --- a/syncplay/client.py +++ b/syncplay/client.py @@ -1929,7 +1929,13 @@ class SyncplayPlaylist(): self._ui.showMessage("Playlist saved as {}".format(path)) # TODO: Move to messages_en + def playlistNeedsRestoring(self, files, username): + return self._client.sharedPlaylistIsEnabled() and self._playlist != None and files == [] and username == None and not self._playlistBufferIsFromOldRoom(self._client.userlist.currentUser.room) + def changePlaylist(self, files, username=None, resetIndex=False): + if self.playlistNeedsRestoring(files, username): + files = self._playlist.copy() + self._playlist = [] self.queuedIndexFilename = None if self._playlist == files: if self._playlistIndex != 0 and resetIndex: