From 7664e6e668601f34153318c76c0d75112d73b51e Mon Sep 17 00:00:00 2001 From: shaun Date: Thu, 26 Mar 2015 16:15:45 +1100 Subject: [PATCH] on UserDataChanged call updatePlayCounts() --- resources/lib/WebSocketClient.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/resources/lib/WebSocketClient.py b/resources/lib/WebSocketClient.py index 982e195c..3273a742 100644 --- a/resources/lib/WebSocketClient.py +++ b/resources/lib/WebSocketClient.py @@ -14,6 +14,7 @@ import websocket from ClientInformation import ClientInformation from DownloadUtils import DownloadUtils from PlaybackUtils import PlaybackUtils +from LibrarySync import LibrarySync _MODE_BASICPLAY=12 @@ -126,11 +127,10 @@ class WebSocketThread(threading.Thread): self.logMsg("Stopping Client NO Object ERROR") def on_message(self, ws, message): - self.logMsg("Message : " + str(message)) + self.logMsg("Message : " + str(message), 0) result = json.loads(message) messageType = result.get("MessageType") - playCommand = result.get("PlayCommand") data = result.get("Data") if(messageType != None and messageType == "Play" and data != None): @@ -174,7 +174,12 @@ class WebSocketThread(threading.Thread): self.logMsg("Playback Seek : " + str(seekPositionTicks)) seekTime = (seekPositionTicks / 1000) / 10000 xbmc.Player().seekTime(seekTime) - + + elif(messageType != None and messageType == "UserDataChanged"): + # for now just do a full playcount sync + self.logMsg("Message : Doing UserDataChanged calling updatePlayCounts()", 0) + LibrarySync().updatePlayCounts() + def on_error(self, ws, error): self.logMsg("Error : " + str(error))