mirror of
https://github.com/Syncplay/syncplay
synced 2025-03-06 11:47:47 +00:00
Add debug messages for VLC/mpv/Client-Server comms
This commit is contained in:
parent
7fb2709629
commit
1b3e370d6d
@ -61,6 +61,7 @@ class SyncplayClient(object):
|
|||||||
constants.SHOW_DIFFERENT_ROOM_OSD = config['showDifferentRoomOSD']
|
constants.SHOW_DIFFERENT_ROOM_OSD = config['showDifferentRoomOSD']
|
||||||
constants.SHOW_SAME_ROOM_OSD = config['showSameRoomOSD']
|
constants.SHOW_SAME_ROOM_OSD = config['showSameRoomOSD']
|
||||||
constants.SHOW_DURATION_NOTIFICATION = config['showDurationNotification']
|
constants.SHOW_DURATION_NOTIFICATION = config['showDurationNotification']
|
||||||
|
constants.DEBUG_MODE = config['debug']
|
||||||
self.lastLeftTime = 0
|
self.lastLeftTime = 0
|
||||||
self.lastLeftUser = u""
|
self.lastLeftUser = u""
|
||||||
self.protocolFactory = SyncClientFactory(self)
|
self.protocolFactory = SyncClientFactory(self)
|
||||||
@ -637,6 +638,10 @@ class UiManager(object):
|
|||||||
self.__ui = ui
|
self.__ui = ui
|
||||||
self.lastError = ""
|
self.lastError = ""
|
||||||
|
|
||||||
|
def showDebugMessage(self, message):
|
||||||
|
if constants.DEBUG_MODE and message.rstrip():
|
||||||
|
print "{}{}".format(time.strftime(constants.UI_TIME_FORMAT, time.localtime()),message.rstrip())
|
||||||
|
|
||||||
def showMessage(self, message, noPlayer=False, noTimestamp=False):
|
def showMessage(self, message, noPlayer=False, noTimestamp=False):
|
||||||
if not noPlayer: self.showOSDMessage(message)
|
if not noPlayer: self.showOSDMessage(message)
|
||||||
self.__ui.showMessage(message, noTimestamp)
|
self.__ui.showMessage(message, noTimestamp)
|
||||||
|
@ -22,6 +22,7 @@ SHOW_SLOWDOWN_OSD = True # Show notifications of slowing down / reverting on ti
|
|||||||
SHOW_SAME_ROOM_OSD = True # Show OSD notifications for events relating to room user is in
|
SHOW_SAME_ROOM_OSD = True # Show OSD notifications for events relating to room user is in
|
||||||
SHOW_DIFFERENT_ROOM_OSD = False # Show OSD notifications for events relating to room user is not in
|
SHOW_DIFFERENT_ROOM_OSD = False # Show OSD notifications for events relating to room user is not in
|
||||||
SHOW_DURATION_NOTIFICATION = True
|
SHOW_DURATION_NOTIFICATION = True
|
||||||
|
DEBUG_MODE = False
|
||||||
|
|
||||||
#Changing these might be ok
|
#Changing these might be ok
|
||||||
DEFAULT_REWIND_THRESHOLD = 4
|
DEFAULT_REWIND_THRESHOLD = 4
|
||||||
|
@ -148,6 +148,8 @@ class MplayerPlayer(BasePlayer):
|
|||||||
self._paused = value
|
self._paused = value
|
||||||
|
|
||||||
def lineReceived(self, line):
|
def lineReceived(self, line):
|
||||||
|
if line:
|
||||||
|
self._client.ui.showDebugMessage("player << {}".format(line))
|
||||||
match = self.RE_ANSWER.match(line)
|
match = self.RE_ANSWER.match(line)
|
||||||
if not match:
|
if not match:
|
||||||
self._handleUnknownLine(line)
|
self._handleUnknownLine(line)
|
||||||
@ -290,6 +292,7 @@ class MplayerPlayer(BasePlayer):
|
|||||||
def sendLine(self, line):
|
def sendLine(self, line):
|
||||||
try:
|
try:
|
||||||
line = (line.decode('utf8') + u"\n").encode('utf8')
|
line = (line.decode('utf8') + u"\n").encode('utf8')
|
||||||
|
self.__playerController._client.ui.showDebugMessage("player >> {}".format(line))
|
||||||
self.__process.stdin.write(line)
|
self.__process.stdin.write(line)
|
||||||
except IOError:
|
except IOError:
|
||||||
pass
|
pass
|
||||||
|
@ -130,6 +130,7 @@ class VlcPlayer(BasePlayer):
|
|||||||
self._listener.sendLine("get-filename")
|
self._listener.sendLine("get-filename")
|
||||||
|
|
||||||
def lineReceived(self, line):
|
def lineReceived(self, line):
|
||||||
|
self._client.ui.showDebugMessage("player >> {}".format(line))
|
||||||
match, name, value = self.RE_ANSWER.match(line), "", ""
|
match, name, value = self.RE_ANSWER.match(line), "", ""
|
||||||
if match:
|
if match:
|
||||||
name, value = match.group('command'), match.group('argument')
|
name, value = match.group('command'), match.group('argument')
|
||||||
@ -327,15 +328,14 @@ class VlcPlayer(BasePlayer):
|
|||||||
self.__playerController.drop()
|
self.__playerController.drop()
|
||||||
|
|
||||||
def found_terminator(self):
|
def found_terminator(self):
|
||||||
# print "received: {}".format("".join(self._ibuffer))
|
|
||||||
self.__playerController.lineReceived("".join(self._ibuffer))
|
self.__playerController.lineReceived("".join(self._ibuffer))
|
||||||
self._ibuffer = []
|
self._ibuffer = []
|
||||||
|
|
||||||
def sendLine(self, line):
|
def sendLine(self, line):
|
||||||
if self.connected:
|
if self.connected:
|
||||||
# print "send: {}".format(line)
|
|
||||||
try:
|
try:
|
||||||
self.push(line + "\n")
|
self.push(line + "\n")
|
||||||
|
self._client.ui.showDebugMessage("player >> {}".format(line))
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
if line == "close-vlc":
|
if line == "close-vlc":
|
||||||
|
@ -30,6 +30,7 @@ class JSONCommandProtocol(LineReceiver):
|
|||||||
if not line:
|
if not line:
|
||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
|
self._client.ui.showDebugMessage("client/server << {}".format(line))
|
||||||
messages = json.loads(line)
|
messages = json.loads(line)
|
||||||
except:
|
except:
|
||||||
self.dropWithError(getMessage("not-json-server-error").format(line))
|
self.dropWithError(getMessage("not-json-server-error").format(line))
|
||||||
@ -39,6 +40,7 @@ class JSONCommandProtocol(LineReceiver):
|
|||||||
def sendMessage(self, dict_):
|
def sendMessage(self, dict_):
|
||||||
line = json.dumps(dict_)
|
line = json.dumps(dict_)
|
||||||
self.sendLine(line)
|
self.sendLine(line)
|
||||||
|
self._client.ui.showDebugMessage("client/server >> {}".format(line))
|
||||||
|
|
||||||
def drop(self):
|
def drop(self):
|
||||||
self.transport.loseConnection()
|
self.transport.loseConnection()
|
||||||
|
@ -117,9 +117,6 @@ class MainWindow(QtGui.QMainWindow):
|
|||||||
|
|
||||||
def userListChange(self):
|
def userListChange(self):
|
||||||
self._syncplayClient.showUserList()
|
self._syncplayClient.showUserList()
|
||||||
|
|
||||||
def showDebugMessage(self, message):
|
|
||||||
print(message)
|
|
||||||
|
|
||||||
def showErrorMessage(self, message, criticalerror = False):
|
def showErrorMessage(self, message, criticalerror = False):
|
||||||
message = unicode(message)
|
message = unicode(message)
|
||||||
|
Loading…
Reference in New Issue
Block a user