Ensure MPC-HC resets position on playlist change (#618)

This commit is contained in:
Etoh 2023-08-04 21:02:21 +01:00
parent 8ba286567d
commit 8e8d6cf804
1 changed files with 4 additions and 2 deletions

View File

@ -407,7 +407,7 @@ class MPCHCAPIPlayer(BasePlayer):
def openFile(self, filePath, resetPosition=False):
self._mpcApi.openFile(filePath)
if resetPosition:
self.setPosition(0)
self.setPosition(0, resetPosition=True)
def displayMessage(
self, message,
@ -429,9 +429,11 @@ class MPCHCAPIPlayer(BasePlayer):
pass
@retry(MpcHcApi.PlayerNotReadyException, constants.MPC_MAX_RETRIES, constants.MPC_RETRY_WAIT_TIME, 1)
def setPosition(self, value):
def setPosition(self, value, resetPosition=False):
if self._mpcApi.filePlaying:
self._mpcApi.seek(value)
elif resetPosition:
raise MpcHcApi.PlayerNotReadyException()
def __getPosition(self):
self.__positionUpdate.clear()