From 3118434c4776224dd20fe6edd2f2c9d615bf9838 Mon Sep 17 00:00:00 2001 From: angelblue05 Date: Fri, 19 Jun 2015 07:20:31 -0500 Subject: [PATCH] Watched status Moved away from Json RPC for DB write instead. --- resources/lib/WriteKodiVideoDB.py | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/resources/lib/WriteKodiVideoDB.py b/resources/lib/WriteKodiVideoDB.py index a33ad204..68555491 100644 --- a/resources/lib/WriteKodiVideoDB.py +++ b/resources/lib/WriteKodiVideoDB.py @@ -39,18 +39,11 @@ class WriteKodiVideoDB(): cursor = connection.cursor() cursor.execute("SELECT emby_id FROM emby WHERE media_type=? AND kodi_id=?",(type,id)) - emby_id = cursor.fetchone()[0] - cursor.close + emby_id = cursor.fetchone() if(emby_id != None): + emby_id = emby_id[0] # Erase resume point when user marks watched/unwatched to follow Emby behavior - # Also force sets the playcount to instantly reflect the appropriate playstate. - if type == "episode": - resume = '{"jsonrpc": "2.0", "method": "VideoLibrary.SetEpisodeDetails", "params": {"episodeid": %d, "playcount": %d, "resume": {"position": 0}}, "id": "setResumePoint"}' % (id, playcount) - elif type == "movie": - resume = '{"jsonrpc": "2.0", "method": "VideoLibrary.SetMovieDetails", "params": {"movieid": %d, "playcount": %d, "resume": {"position": 0}}, "id": "setResumePoint"}' % (id, playcount) - xbmc.executeJSONRPC(resume) - addon = xbmcaddon.Addon(id='plugin.video.emby') downloadUtils = DownloadUtils() watchedurl = "{server}/mediabrowser/Users/{UserId}/PlayedItems/%s" % emby_id @@ -58,6 +51,9 @@ class WriteKodiVideoDB(): downloadUtils.downloadUrl(watchedurl, type="POST") else: downloadUtils.downloadUrl(watchedurl, type="DELETE") + + self.setKodiResumePoint(id, 0, 0, cursor) + cursor.close def addOrUpdateMovieToKodiLibrary( self, embyId ,connection, cursor, viewTag):