allow play count updates to be pushed to the server even if sync is running

This commit is contained in:
faush01 2015-03-18 14:18:30 +11:00
parent 7bd7c10a0f
commit c6917f5bd3
2 changed files with 17 additions and 13 deletions

View File

@ -91,7 +91,7 @@ class CreateFiles():
changes = False
if not xbmcvfs.exists(nfoFile):
changes = True
utils.logMsg("MB3 Syncer","creating NFO file " + nfoFile)
#utils.logMsg("MB3 Syncer","creating NFO file " + nfoFile)
xbmcvfs.mkdir(itemPath)
root = Element(rootelement)
SubElement(root, "id").text = item["Id"]

View File

@ -23,16 +23,20 @@ class Kodi_Monitor(xbmc.Monitor):
if method == "VideoLibrary.OnUpdate":
#check windowprop if the sync is busy to prevent any false updates
WINDOW = xbmcgui.Window( 10000 )
if WINDOW.getProperty("librarysync") != "busy":
xbmc.log("Kodi_Monitor -> onNotification -> VideoLibrary.OnUpdate : " + str(data))
jsondata = json.loads(data)
if jsondata != None:
playcount = None
playcount = jsondata.get("playcount")
item = jsondata.get("item").get("id")
type = jsondata.get("item").get("type")
if playcount != None:
WriteKodiDB().updatePlayCountFromKodi(item, type, playcount)
#WINDOW = xbmcgui.Window( 10000 )
#if WINDOW.getProperty("librarysync") != "busy":
# I don't thing we need this, the playcount is not present in updates that don't touch that
# and when the playcount is updated byt he sync it just sends the same data back to the server
# if you add this back in you will never be able to trigger a play status update while the sync is running
xbmc.log("Kodi_Monitor -> onNotification -> VideoLibrary.OnUpdate : " + str(data))
jsondata = json.loads(data)
if jsondata != None:
playcount = None
playcount = jsondata.get("playcount")
item = jsondata.get("item").get("id")
type = jsondata.get("item").get("type")
if playcount != None:
WriteKodiDB().updatePlayCountFromKodi(item, type, playcount)