setPause to set rather than cycle pause property for newMPV

This commit is contained in:
Et0h 2016-10-17 14:18:19 +01:00
parent e295b8ad41
commit 580af0c2c1

View File

@ -110,11 +110,14 @@ class NewMpvPlayer(OldMpvPlayer):
lastMPVPositionUpdate = None lastMPVPositionUpdate = None
def setPaused(self, value): def setPaused(self, value):
if self._paused <> value: if self._paused == value:
self._paused = not self._paused self._client.ui.showDebugMessage("Not sending setPaused to mpv as state is already {}".format(value))
self._listener.sendLine('cycle pause') return
if value == False: pauseValue = "yes" if value else "no"
self.lastMPVPositionUpdate = time.time() self._setProperty("pause", pauseValue)
self._paused = value
if value == False:
self.lastMPVPositionUpdate = time.time()
def _getProperty(self, property_): def _getProperty(self, property_):
floatProperties = ['length','time-pos'] floatProperties = ['length','time-pos']
@ -247,4 +250,4 @@ class NewMpvPlayer(OldMpvPlayer):
if self.fileLoaded == True and self.lastLoadedTime != None and time.time() > (self.lastLoadedTime + constants.MPV_NEWFILE_IGNORE_TIME): if self.fileLoaded == True and self.lastLoadedTime != None and time.time() > (self.lastLoadedTime + constants.MPV_NEWFILE_IGNORE_TIME):
return True return True
else: else:
return False return False