From fdb42c1f269a064fbd549d8b638aed6fbd0e6fda Mon Sep 17 00:00:00 2001 From: tomkat83 Date: Thu, 7 Apr 2016 13:49:05 +0200 Subject: [PATCH] Fix Kodi information screen not working --- resources/lib/kodidb_functions.py | 21 +++++++++++++++++++++ resources/lib/librarysync.py | 4 ++++ 2 files changed, 25 insertions(+) diff --git a/resources/lib/kodidb_functions.py b/resources/lib/kodidb_functions.py index 65caf522..2ce6ef02 100644 --- a/resources/lib/kodidb_functions.py +++ b/resources/lib/kodidb_functions.py @@ -47,6 +47,27 @@ class Kodidb_Functions(): self.clientInfo = clientinfo.ClientInfo() self.artwork = artwork.Artwork() + def pathHack(self): + """ + Use with Kodi video DB + + Sets strContent to e.g. 'movies' and strScraper to metadata.local + + For some reason, Kodi ignores this if done via itemtypes while e.g. + adding or updating items. (addPath method does NOT work) + """ + types = ['movies', 'tvshows'] + query = ' '.join(( + "UPDATE path", + "SET strContent = ?, strScraper = ?", + "WHERE strPath LIKE ?" + )) + for typus in types: + self.cursor.execute( + query, (typus, + 'metadata.local', + 'plugin://plugin.video.plexkodiconnect.%s%%' % typus)) + def addPath(self, path, strHash=None): # SQL won't return existing paths otherwise if path is None: diff --git a/resources/lib/librarysync.py b/resources/lib/librarysync.py index 63380695..ff9faec4 100644 --- a/resources/lib/librarysync.py +++ b/resources/lib/librarysync.py @@ -460,6 +460,10 @@ class LibrarySync(Thread): if utils.window('plex_scancrashed') == 'true': xbmcgui.Dialog().ok(self.addonName, self.__language__(39408)) utils.window('plex_scancrashed', clear=True) + + # Path hack, so Kodis Information screen works + with kodidb.GetKodiDB('video') as kodi_db: + kodi_db.pathHack() return True def processView(self, folderItem, kodi_db, emby_db, totalnodes):