From 4b6f192b4b4291b39e372401cdc4189531b5f881 Mon Sep 17 00:00:00 2001 From: Marcel van der Veldt Date: Wed, 1 Apr 2015 23:28:19 +0200 Subject: [PATCH] fixed actors in tvshows --- resources/lib/WriteKodiDB.py | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/resources/lib/WriteKodiDB.py b/resources/lib/WriteKodiDB.py index 0aa36916..13d2f8d7 100644 --- a/resources/lib/WriteKodiDB.py +++ b/resources/lib/WriteKodiDB.py @@ -295,6 +295,7 @@ class WriteKodiDB(): thumbPath = API().getArtwork(MBitem, "Primary") changes = False + #set Filename playurl = PlayUtils().getPlayUrl(server, MBitem["Id"], MBitem) @@ -998,13 +999,30 @@ class WriteKodiDB(): connection = utils.KodiSQL() cursor = connection.cursor() - #create the path + #create the tv show path cursor.execute("select coalesce(max(idPath),0) as pathid from path") pathid = cursor.fetchone()[0] pathid = pathid + 1 pathsql="insert into path(idPath, strPath, strContent, strScraper, noUpdate) values(?, ?, ?, ?, ?)" cursor.execute(pathsql, (pathid,path,None,None,1)) + #create toplevel path as monitored source - needed for things like actors and stuff to work (no clue why) + if "\\" in path: + toplevelpathstr = path.rsplit("\\",2)[1] + toplevelpath = path.replace(toplevelpathstr + "\\","") + elif "/" in path: + toplevelpathstr = path.rsplit("/",2)[1] + toplevelpath = path.replace(toplevelpathstr + "/","") + cursor.execute("SELECT idPath as tlpathid FROM path WHERE strPath = ?",(toplevelpath,)) + result = cursor.fetchone() + if result == None: + cursor.execute("select coalesce(max(idPath),0) as tlpathid from path") + tlpathid = cursor.fetchone()[0] + tlpathid = pathid + 1 + pathsql="insert into path(idPath, strPath, strContent, strScraper, noUpdate) values(?, ?, ?, ?, ?)" + cursor.execute(pathsql, (tlpathid,toplevelpath,"tvshows","metadata.local",1)) + + runtime = int(timeInfo.get('Duration'))*60 plot = utils.convertEncoding(API().getOverview(MBitem)) thumb = "" + API().getArtwork(MBitem, "Primary") + "" @@ -1243,7 +1261,7 @@ class WriteKodiDB(): Name = person.get("Name") Role = person.get("Role") actorid = None - Thumb = downloadUtils.imageUrl(person.get("Id"), "Primary", 0, 400, 400) + Thumb = "" + downloadUtils.imageUrl(person.get("Id"), "Primary", 0, 400, 400) + "" cursor.execute("SELECT idActor as actorid FROM actors WHERE strActor = ?",(Name,)) result = cursor.fetchone() if result != None: