From c46529bb8ad07126407d61c00ec22abda25a0952 Mon Sep 17 00:00:00 2001 From: Etoh Date: Fri, 2 Jun 2023 19:15:36 +0100 Subject: [PATCH] Playlist restoration should not undo clearing actions (#609) --- syncplay/__init__.py | 2 +- syncplay/client.py | 10 +++------- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/syncplay/__init__.py b/syncplay/__init__.py index 8a7cea0..8768bee 100755 --- a/syncplay/__init__.py +++ b/syncplay/__init__.py @@ -1,5 +1,5 @@ version = '1.7.0' revision = '' milestone = 'Yoitsu' -release_number = '106' +release_number = '107' projectURL = 'https://syncplay.pl/' diff --git a/syncplay/client.py b/syncplay/client.py index 559bef0..a07965d 100755 --- a/syncplay/client.py +++ b/syncplay/client.py @@ -136,6 +136,7 @@ class SyncplayClient(object): self._warnings = self._WarningManager(self._player, self.userlist, self.ui, self) self.fileSwitch = FileSwitchManager(self) self.playlist = SyncplayPlaylist(self) + self.playlistMayNeedRestoring = False self._serverSupportsTLS = True @@ -858,6 +859,7 @@ class SyncplayClient(object): def retry(retries): self._lastGlobalUpdate = None self.ui.setSSLMode(False) + self.playlistMayNeedRestoring = True if retries == 0: self.onDisconnect() if retries > constants.RECONNECT_RETRIES: @@ -1954,13 +1956,6 @@ class SyncplayPlaylist(): playlistFile.write(playlistToSave) 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 playlistNeedsRestoring(self, files, username): - return self._client.sharedPlaylistIsEnabled() and len(self._playlist) > 0 and not files and username == None and (self._previousPlaylistRoom == None or self._previousPlaylistRoom == self._client.userlist.currentUser.room) - def changePlaylist(self, files, username=None, resetIndex=False): if self.playlistNeedsRestoring(files, username): self._ui.showDebugMessage("Restoring playlist on reconnect...") @@ -1969,6 +1964,7 @@ class SyncplayPlaylist(): self._client._protocol.setPlaylistIndex(self._playlistIndex) return self.queuedIndexFilename = None + self._client.playlistMayNeedRestoring = False if self._playlist == files: if self._playlistIndex != 0 and resetIndex: self.changeToPlaylistIndex(0)