set playedcount and lastplayeddate after resumepoint db change

This commit is contained in:
Marcel van der Veldt 2015-03-24 21:29:57 +01:00
parent 2d531474d7
commit 1ca1c55345

View file

@ -816,17 +816,16 @@ class LibrarySync():
timeInfo = API().getTimeInfo(item) timeInfo = API().getTimeInfo(item)
if kodiItem != None: 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"))) kodiresume = int(round(kodiItem['resume'].get("position")))
resume = int(round(float(timeInfo.get("ResumeTime"))))*60 resume = int(round(float(timeInfo.get("ResumeTime"))))*60
total = int(round(float(timeInfo.get("TotalTime"))))*60 total = int(round(float(timeInfo.get("TotalTime"))))*60
if kodiresume != resume: if kodiresume != resume:
WriteKodiDB().setKodiResumePoint(kodiItem['movieid'],resume,total,"movie") WriteKodiDB().setKodiResumePoint(kodiItem['movieid'],resume,total,"movie")
totalPositionsUpdated += 1 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)): if(self.ShouldStop(pDialog)):
return True return True
@ -879,11 +878,6 @@ class LibrarySync():
if kodiItem != None: if kodiItem != None:
WINDOW = xbmcgui.Window( 10000 ) WINDOW = xbmcgui.Window( 10000 )
WINDOW.setProperty("episodeid" + str(kodiItem['episodeid']), episode.get('Name') + ";;" + episode.get('Id')) 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"))) kodiresume = int(round(kodiItem['resume'].get("position")))
resume = int(round(float(timeInfo.get("ResumeTime"))))*60 resume = int(round(float(timeInfo.get("ResumeTime"))))*60
total = int(round(float(timeInfo.get("TotalTime"))))*60 total = int(round(float(timeInfo.get("TotalTime"))))*60
@ -891,6 +885,10 @@ class LibrarySync():
WriteKodiDB().setKodiResumePoint(kodiItem['episodeid'],resume,total,"episode") WriteKodiDB().setKodiResumePoint(kodiItem['episodeid'],resume,total,"episode")
totalPositionsUpdated += 1 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)): if(self.ShouldStop(pDialog)):
return True return True