From 1ca1c553457020a7ae6043112faf4252216173e4 Mon Sep 17 00:00:00 2001 From: Marcel van der Veldt Date: Tue, 24 Mar 2015 21:29:57 +0100 Subject: [PATCH] set playedcount and lastplayeddate after resumepoint db change --- resources/lib/LibrarySync.py | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/resources/lib/LibrarySync.py b/resources/lib/LibrarySync.py index 209dccb2..675c3395 100644 --- a/resources/lib/LibrarySync.py +++ b/resources/lib/LibrarySync.py @@ -816,17 +816,16 @@ class LibrarySync(): timeInfo = API().getTimeInfo(item) if kodiItem != None: - updated = WriteKodiDB().updateProperty(kodiItem,"playcount",int(userData.get("PlayCount")), "movie") - updated = WriteKodiDB().updateProperty(kodiItem,"lastplayed",userData.get("LastPlayedDate"), "movie") - if(updated): - totalCountsUpdated += 1 kodiresume = int(round(kodiItem['resume'].get("position"))) resume = int(round(float(timeInfo.get("ResumeTime"))))*60 total = int(round(float(timeInfo.get("TotalTime"))))*60 if kodiresume != resume: WriteKodiDB().setKodiResumePoint(kodiItem['movieid'],resume,total,"movie") totalPositionsUpdated += 1 - + updated = WriteKodiDB().updateProperty(kodiItem,"playcount",int(userData.get("PlayCount")), "movie") + updated = WriteKodiDB().updateProperty(kodiItem,"lastplayed",userData.get("LastPlayedDate"), "movie") + if(updated): + totalCountsUpdated += 1 if(self.ShouldStop(pDialog)): return True @@ -879,18 +878,17 @@ class LibrarySync(): if kodiItem != None: WINDOW = xbmcgui.Window( 10000 ) WINDOW.setProperty("episodeid" + str(kodiItem['episodeid']), episode.get('Name') + ";;" + episode.get('Id')) - if kodiItem['playcount'] != int(userData.get("PlayCount")): - updated = WriteKodiDB().updateProperty(kodiItem,"playcount",int(userData.get("PlayCount")),"episode") - updated = WriteKodiDB().updateProperty(kodiItem,"lastplayed",userData.get("LastPlayedDate"), "episode") - if(updated): - totalCountsUpdated += 1 kodiresume = int(round(kodiItem['resume'].get("position"))) resume = int(round(float(timeInfo.get("ResumeTime"))))*60 total = int(round(float(timeInfo.get("TotalTime"))))*60 if kodiresume != resume: WriteKodiDB().setKodiResumePoint(kodiItem['episodeid'],resume,total,"episode") totalPositionsUpdated += 1 - + + updated = WriteKodiDB().updateProperty(kodiItem,"playcount",int(userData.get("PlayCount")),"episode") + updated = WriteKodiDB().updateProperty(kodiItem,"lastplayed",userData.get("LastPlayedDate"), "episode") + if(updated): + totalCountsUpdated += 1 if(self.ShouldStop(pDialog)): return True