This commit is contained in:
Uriziel 2014-01-22 23:31:17 +01:00
parent f3d1d76942
commit e9fba696f7

View File

@ -393,16 +393,18 @@ class MPCHCAPIPlayer(BasePlayer):
@retry(MpcHcApi.PlayerNotReadyException, constants.MPC_MAX_RETRIES, constants.MPC_RETRY_WAIT_TIME, 1) @retry(MpcHcApi.PlayerNotReadyException, constants.MPC_MAX_RETRIES, constants.MPC_RETRY_WAIT_TIME, 1)
def setPaused(self, value): def setPaused(self, value):
if self.__switchPauseCalls: if self._mpcApi.filePlaying:
value = not value if self.__switchPauseCalls:
if value: value = not value
self._mpcApi.pause() if value:
else: self._mpcApi.pause()
self._mpcApi.unpause() else:
self._mpcApi.unpause()
@retry(MpcHcApi.PlayerNotReadyException, constants.MPC_MAX_RETRIES, constants.MPC_RETRY_WAIT_TIME, 1) @retry(MpcHcApi.PlayerNotReadyException, constants.MPC_MAX_RETRIES, constants.MPC_RETRY_WAIT_TIME, 1)
def setPosition(self, value): def setPosition(self, value):
self._mpcApi.seek(value) if self._mpcApi.filePlaying:
self._mpcApi.seek(value)
def __getPosition(self): def __getPosition(self):
self.__positionUpdate.clear() self.__positionUpdate.clear()
@ -412,7 +414,7 @@ class MPCHCAPIPlayer(BasePlayer):
@retry(MpcHcApi.PlayerNotReadyException, constants.MPC_MAX_RETRIES, constants.MPC_RETRY_WAIT_TIME, 1) @retry(MpcHcApi.PlayerNotReadyException, constants.MPC_MAX_RETRIES, constants.MPC_RETRY_WAIT_TIME, 1)
def askForStatus(self): def askForStatus(self):
if(self.__preventAsking.wait(0) and self.__fileUpdate.acquire(0)): if(self.__preventAsking.wait(0) and self.__fileUpdate.acquire(0) and self._mpcApi.filePlaying):
self.__fileUpdate.release() self.__fileUpdate.release()
position = self.__getPosition() position = self.__getPosition()
paused = self._mpcApi.isPaused() paused = self._mpcApi.isPaused()