Fixed disconnecing upon file switch.

Hardly clean patch will need a lot of refactoring.
This commit is contained in:
Uriziel 2013-06-08 09:10:58 +02:00
parent be830a11b9
commit 4a48214a45

View File

@ -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)