Hopefully fix playlist index random switch loop bug

This commit is contained in:
Et0h 2016-01-21 22:21:40 +00:00
parent 44f1b77977
commit 18be4a34a1

View File

@ -484,7 +484,8 @@ class SyncplayClient(object):
try: try:
filename = self._playlist[index] filename = self._playlist[index]
self.ui.setPlaylistIndexFilename(filename) self.ui.setPlaylistIndexFilename(filename)
self._playlistIndex = index if not self._config['sharedPlaylistEnabled']:
self._playlistIndex = index
if username is not None and self.userlist.currentUser.file and filename == self.userlist.currentUser.file['name']: if username is not None and self.userlist.currentUser.file and filename == self.userlist.currentUser.file['name']:
return return
except IndexError: except IndexError:
@ -493,13 +494,11 @@ class SyncplayClient(object):
if self._player is None: if self._player is None:
self.__playerReady.addCallback(lambda x: self.changeToPlaylistIndex(index, username)) self.__playerReady.addCallback(lambda x: self.changeToPlaylistIndex(index, username))
return return
self._playlistIndex = index
if username is None and self._protocol and self._protocol.logged and self._config["sharedPlaylistEnabled"]: if username is None and self._protocol and self._protocol.logged and self._config["sharedPlaylistEnabled"]:
self._playlistIndex = index
self._protocol.setPlaylistIndex(index) self._protocol.setPlaylistIndex(index)
else: else:
self.ui.showMessage(u"{} changed the playlist selection".format(username)) self.ui.showMessage(u"{} changed the playlist selection".format(username))
self._playlistIndex = index
self.switchToNewPlaylistIndex(index) self.switchToNewPlaylistIndex(index)