Skip to content

Commit

Permalink
Ensure MPC-HC resets position on playlist change (#618)
Browse files Browse the repository at this point in the history
  • Loading branch information
Et0h committed Aug 4, 2023
1 parent 8ba2865 commit 8e8d6cf
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions syncplay/players/mpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ def initPlayer(self, filePath):
def openFile(self, filePath, resetPosition=False):
self._mpcApi.openFile(filePath)
if resetPosition:
self.setPosition(0)
self.setPosition(0, resetPosition=True)

def displayMessage(
self, message,
Expand All @@ -429,9 +429,11 @@ def setFeatures(self, featureList):
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()
Expand Down

0 comments on commit 8e8d6cf

Please sign in to comment.