From 4a48214a45cefe377ac8d5b3590744f9e3407f0f Mon Sep 17 00:00:00 2001 From: Uriziel Date: Sat, 8 Jun 2013 09:10:58 +0200 Subject: [PATCH] Fixed disconnecing upon file switch. Hardly clean patch will need a lot of refactoring. --- syncplay/players/mpc.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/syncplay/players/mpc.py b/syncplay/players/mpc.py index 36cb091..95ed286 100644 --- a/syncplay/players/mpc.py +++ b/syncplay/players/mpc.py @@ -307,6 +307,8 @@ class MPCHCAPIPlayer(BasePlayer): speedSupported = False def __init__(self, client): + from twisted.internet import reactor + self.reactor = reactor self.__client = client self._mpcApi = MpcHcApi() self._mpcApi.callbacks.onUpdateFilename = lambda _: self.__makePing() @@ -448,7 +450,8 @@ class MPCHCAPIPlayer(BasePlayer): def __handleUpdatedFilename(self): with self.__fileUpdate: self.__setUpStateForNewlyOpenedFile() - self.__client.updateFile(self._mpcApi.filePlaying, self._mpcApi.fileDuration, self._mpcApi.filePath) + args = (self._mpcApi.filePlaying, self._mpcApi.fileDuration, self._mpcApi.filePath) + self.reactor.callFromThread(self.__client.updateFile, *args) def __mpcError(self, err=""): self.__client.ui.showErrorMessage(err)