on UserDataChanged call updatePlayCounts()

This commit is contained in:
shaun 2015-03-26 16:15:45 +11:00
parent 43a77bbba2
commit 7664e6e668

View file

@ -14,6 +14,7 @@ import websocket
from ClientInformation import ClientInformation from ClientInformation import ClientInformation
from DownloadUtils import DownloadUtils from DownloadUtils import DownloadUtils
from PlaybackUtils import PlaybackUtils from PlaybackUtils import PlaybackUtils
from LibrarySync import LibrarySync
_MODE_BASICPLAY=12 _MODE_BASICPLAY=12
@ -126,11 +127,10 @@ class WebSocketThread(threading.Thread):
self.logMsg("Stopping Client NO Object ERROR") self.logMsg("Stopping Client NO Object ERROR")
def on_message(self, ws, message): def on_message(self, ws, message):
self.logMsg("Message : " + str(message)) self.logMsg("Message : " + str(message), 0)
result = json.loads(message) result = json.loads(message)
messageType = result.get("MessageType") messageType = result.get("MessageType")
playCommand = result.get("PlayCommand")
data = result.get("Data") data = result.get("Data")
if(messageType != None and messageType == "Play" and data != None): if(messageType != None and messageType == "Play" and data != None):
@ -174,7 +174,12 @@ class WebSocketThread(threading.Thread):
self.logMsg("Playback Seek : " + str(seekPositionTicks)) self.logMsg("Playback Seek : " + str(seekPositionTicks))
seekTime = (seekPositionTicks / 1000) / 10000 seekTime = (seekPositionTicks / 1000) / 10000
xbmc.Player().seekTime(seekTime) 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): def on_error(self, ws, error):
self.logMsg("Error : " + str(error)) self.logMsg("Error : " + str(error))