Fixed disconnecing upon file switch.
Hardly clean patch will need a lot of refactoring.
This commit is contained in:
parent
be830a11b9
commit
4a48214a45
@ -307,6 +307,8 @@ class MPCHCAPIPlayer(BasePlayer):
|
|||||||
speedSupported = False
|
speedSupported = False
|
||||||
|
|
||||||
def __init__(self, client):
|
def __init__(self, client):
|
||||||
|
from twisted.internet import reactor
|
||||||
|
self.reactor = reactor
|
||||||
self.__client = client
|
self.__client = client
|
||||||
self._mpcApi = MpcHcApi()
|
self._mpcApi = MpcHcApi()
|
||||||
self._mpcApi.callbacks.onUpdateFilename = lambda _: self.__makePing()
|
self._mpcApi.callbacks.onUpdateFilename = lambda _: self.__makePing()
|
||||||
@ -448,7 +450,8 @@ class MPCHCAPIPlayer(BasePlayer):
|
|||||||
def __handleUpdatedFilename(self):
|
def __handleUpdatedFilename(self):
|
||||||
with self.__fileUpdate:
|
with self.__fileUpdate:
|
||||||
self.__setUpStateForNewlyOpenedFile()
|
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=""):
|
def __mpcError(self, err=""):
|
||||||
self.__client.ui.showErrorMessage(err)
|
self.__client.ui.showErrorMessage(err)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user