Skip to content

Commit

Permalink
Playlist restoration should not undo clearing actions (#609)
Browse files Browse the repository at this point in the history
  • Loading branch information
Et0h committed Jun 2, 2023
1 parent e4314b4 commit c46529b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
2 changes: 1 addition & 1 deletion syncplay/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
version = '1.7.0'
revision = ''
milestone = 'Yoitsu'
release_number = '106'
release_number = '107'
projectURL = 'https://syncplay.pl/'
10 changes: 3 additions & 7 deletions syncplay/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ def __init__(self, playerClass, ui, config):
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

Expand Down Expand Up @@ -858,6 +859,7 @@ def start(self, host, port):
def retry(retries):
self._lastGlobalUpdate = None
self.ui.setSSLMode(False)
self.playlistMayNeedRestoring = True
if retries == 0:
self.onDisconnect()
if retries > constants.RECONNECT_RETRIES:
Expand Down Expand Up @@ -1954,13 +1956,6 @@ def savePlaylistToFile(self, path):
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...")
Expand All @@ -1969,6 +1964,7 @@ def changePlaylist(self, files, username=None, resetIndex=False):
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)
Expand Down

0 comments on commit c46529b

Please sign in to comment.