diff --git a/resources/lib/LibrarySync.py b/resources/lib/LibrarySync.py index 7345511e..f3fc32aa 100644 --- a/resources/lib/LibrarySync.py +++ b/resources/lib/LibrarySync.py @@ -630,26 +630,27 @@ class LibrarySync(): if type=='Movie': MB3Movie = ReadEmbyDB().getItem(itemID) kodiItem = ReadKodiDB().getKodiMovie(itemID) - + print MB3Movie if(self.ShouldStop()): return True if(MB3Movie == None): return False - if(allKodiMovies == None): + if(kodiItem == None): return False userData=API().getUserData(MB3Movie) timeInfo = API().getTimeInfo(MB3Movie) if kodiItem != None: - WriteKodiDB().updateProperty(kodiItem,"playcount",int(userData.get("PlayCount")),"movie") + 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") - + #write property forced will refresh the item in the list so playcount change is immediately visible + WriteKodiDB().updateProperty(kodiItem,"playcount",int(userData.get("PlayCount")),"movie",True) if(self.ShouldStop()): return True @@ -664,14 +665,13 @@ class LibrarySync(): userData=API().getUserData(MB3Episode) timeInfo = API().getTimeInfo(MB3Episode) if kodiItem != None: - if kodiItem['playcount'] != int(userData.get("PlayCount")): - WriteKodiDB().updateProperty(kodiItem,"playcount",int(userData.get("PlayCount")),"episode") 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") - + #write property forced will refresh the item in the list so playcount change is immediately visible + WriteKodiDB().updateProperty(kodiItem,"playcount",int(userData.get("PlayCount")),"episode",True) if(self.ShouldStop()): return True diff --git a/resources/lib/PlaybackUtils.py b/resources/lib/PlaybackUtils.py index 997f836b..1680388f 100644 --- a/resources/lib/PlaybackUtils.py +++ b/resources/lib/PlaybackUtils.py @@ -105,8 +105,9 @@ class PlaybackUtils(): WINDOW.setProperty(playurl+"SubtitleStreamIndex", str(mediaSources[0].get('DefaultSubtitleStreamIndex'))) #this launches the playback + #artwork only works with both resolvedurl and player command xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, listItem) - + xbmc.Player().play(playurl,listItem) def setArt(self, list,name,path): if name=='thumb' or name=='fanart_image' or name=='small_poster' or name=='tiny_poster' or name == "medium_landscape" or name=='medium_poster' or name=='small_fanartimage' or name=='medium_fanartimage' or name=='fanart_noindicators': diff --git a/resources/lib/WriteKodiDB.py b/resources/lib/WriteKodiDB.py index ec4f6530..02d6147e 100644 --- a/resources/lib/WriteKodiDB.py +++ b/resources/lib/WriteKodiDB.py @@ -310,7 +310,7 @@ class WriteKodiDB(): return changes # adds or updates the given property on the videofile in Kodi database - def updateProperty(self,KodiItem,propertyName,propertyValue,fileType): + def updateProperty(self,KodiItem,propertyName,propertyValue,fileType,forced=False): if fileType == "tvshow": id = KodiItem['tvshowid'] jsoncommand_i = '{"jsonrpc": "2.0", "method": "VideoLibrary.SetTVShowDetails", "params": { "tvshowid": %i, "%s": %i}, "id": 1 }' @@ -329,7 +329,7 @@ class WriteKodiDB(): jsoncommand_s = '{"jsonrpc": "2.0", "method": "VideoLibrary.SetMovieDetails", "params": { "movieid": %i, "%s": "%s"}, "id": 1 }' changes = False - if propertyValue != KodiItem[propertyName]: + if ((propertyValue != KodiItem[propertyName]) or forced): if propertyValue != None: if type(propertyValue) is int: xbmc.sleep(sleepVal)