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 changes = False
if not xbmcvfs.exists(nfoFile): if not xbmcvfs.exists(nfoFile):
changes = True changes = True
utils.logMsg("MB3 Syncer","creating NFO file " + nfoFile) #utils.logMsg("MB3 Syncer","creating NFO file " + nfoFile)
xbmcvfs.mkdir(itemPath) xbmcvfs.mkdir(itemPath)
root = Element(rootelement) root = Element(rootelement)
SubElement(root, "id").text = item["Id"] SubElement(root, "id").text = item["Id"]

View file

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