Reduce MPC problems when file change takes too long

This commit is contained in:
Et0h 2015-12-07 21:55:23 +00:00
parent 2c885d07b2
commit 1964d25e96

View File

@ -419,8 +419,8 @@ class MPCHCAPIPlayer(BasePlayer):
self.__positionUpdate.wait(constants.MPC_LOCK_WAIT_TIME) self.__positionUpdate.wait(constants.MPC_LOCK_WAIT_TIME)
return self._mpcApi.lastFilePosition return self._mpcApi.lastFilePosition
@retry(MpcHcApi.PlayerNotReadyException, constants.MPC_MAX_RETRIES, constants.MPC_RETRY_WAIT_TIME, 1)
def askForStatus(self): def askForStatus(self):
try:
if self._mpcApi.filePlaying and self.__preventAsking.wait(0) and self.__fileUpdate.acquire(0): if self._mpcApi.filePlaying and self.__preventAsking.wait(0) and self.__fileUpdate.acquire(0):
self.__fileUpdate.release() self.__fileUpdate.release()
position = self.__getPosition() position = self.__getPosition()
@ -429,7 +429,9 @@ class MPCHCAPIPlayer(BasePlayer):
if self.__preventAsking.wait(0) and self.__fileUpdate.acquire(0): if self.__preventAsking.wait(0) and self.__fileUpdate.acquire(0):
self.__client.updatePlayerStatus(paused, position) self.__client.updatePlayerStatus(paused, position)
self.__fileUpdate.release() self.__fileUpdate.release()
return else:
self.__echoGlobalStatus()
except MpcHcApi.PlayerNotReadyException:
self.__echoGlobalStatus() self.__echoGlobalStatus()
def __echoGlobalStatus(self): def __echoGlobalStatus(self):