Syncplay should not re-open current file (it causes rewinds on some players)

This commit is contained in:
Et0h 2016-12-20 20:23:21 +00:00
parent abd46d0e6c
commit ad9b3884a6

View File

@ -600,6 +600,8 @@ class MainWindow(QtGui.QMainWindow):
def playlistItemClicked(self, item):
# TODO: Integrate into client.py code
filename = item.data()
if self._isTryingToChangeToCurrentFile(filename):
return
if isURL(filename):
self._syncplayClient._player.openFile(filename)
else:
@ -609,6 +611,13 @@ class MainWindow(QtGui.QMainWindow):
else:
self._syncplayClient.ui.showErrorMessage(getMessage("cannot-find-file-for-playlist-switch-error").format(filename))
def _isTryingToChangeToCurrentFile(self, filename):
if self._syncplayClient.userlist.currentUser.file and filename == self._syncplayClient.userlist.currentUser.file["name"]:
self.showDebugMessage("File change request ignored (Syncplay should not be asked to change to current filename)")
return True
else:
return False
def roomClicked(self, item):
username = item.sibling(item.row(), 0).data()
filename = item.sibling(item.row(), 3).data()
@ -618,7 +627,7 @@ class MainWindow(QtGui.QMainWindow):
if roomToJoin <> self._syncplayClient.getRoom():
self.joinRoom(item.sibling(item.row(), 0).data())
elif username and filename and username <> self._syncplayClient.userlist.currentUser.username:
if self._syncplayClient.userlist.currentUser.file and filename == self._syncplayClient.userlist.currentUser.file:
if self._isTryingToChangeToCurrentFile(filename):
return
if isURL(filename):
self._syncplayClient._player.openFile(filename)