added support for Kodi Isengard

This commit is contained in:
Marcel van der Veldt 2015-04-08 10:01:04 +02:00
parent a464924f6f
commit 8ac8596d6f

View file

@ -1293,9 +1293,9 @@ class WriteKodiDB():
utils.logMsg("AddActorsToMedia", "List needs updating") utils.logMsg("AddActorsToMedia", "List needs updating")
# xbmc.sleep(sleepVal) kodiVersion = 14
#connection = utils.KodiSQL() if xbmc.getInfoLabel("System.BuildVersion").startswith("15"):
#cursor = connection.cursor() kodiVersion = 15
if(people != None): if(people != None):
for person in people: for person in people:
@ -1306,24 +1306,45 @@ class WriteKodiDB():
Role = person.get("Role") Role = person.get("Role")
actorid = None 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,)) if kodiVersion == 15:
# Kodi Isengard database #
if Thumb != None:
Thumb = "<thumb>" + Thumb + "</thumb>"
cursor.execute("SELECT actor_id as actorid FROM actor WHERE name = ?",(Name,))
else:
# Kodi Gotham or Helix database #
cursor.execute("SELECT idActor as actorid FROM actors WHERE strActor = ?",(Name,))
result = cursor.fetchone() result = cursor.fetchone()
if result != None: if result != None:
actorid = result[0] actorid = result[0]
if actorid == None: if actorid == None:
cursor.execute("select coalesce(max(idActor),0) as actorid from actors") if kodiVersion == 15:
actorid = cursor.fetchone()[0] # Kodi Isengard database #
actorid = actorid + 1 cursor.execute("select coalesce(max(actor_id),0) as actorid from actor")
peoplesql="insert into actors(idActor, strActor, strThumb) values(?, ?, ?)" actorid = cursor.fetchone()[0]
actorid = actorid + 1
peoplesql="insert into actor(actor_id, name, art_urls) values(?, ?, ?)"
else:
# Kodi Gotham or Helix database #
cursor.execute("select coalesce(max(idActor),0) as actorid from actors")
actorid = cursor.fetchone()[0]
actorid = actorid + 1
peoplesql="insert into actors(idActor, strActor, strThumb) values(?, ?, ?)"
cursor.execute(peoplesql, (actorid,Name,Thumb)) cursor.execute(peoplesql, (actorid,Name,Thumb))
if mediatype == "movie": if kodiVersion == 15:
peoplesql="INSERT OR REPLACE into actorlinkmovie(idActor, idMovie, strRole, iOrder) values(?, ?, ?, ?)" # Kodi Isengard database #
if mediatype == "tvshow": peoplesql="INSERT OR REPLACE into actor_link(actor_id, media_id, media_type, role, cast_order) values(?, ?, ?, ?, ?)"
peoplesql="INSERT OR REPLACE into actorlinktvshow(idActor, idShow, strRole, iOrder) values(?, ?, ?, ?)" cursor.execute(peoplesql, (actorid, id, mediatype, Role, None))
if mediatype == "episode": else:
peoplesql="INSERT OR REPLACE into actorlinkepisode(idActor, idEpisode, strRole, iOrder) values(?, ?, ?, ?)" # Kodi Gotham or Helix database #
cursor.execute(peoplesql, (actorid,id,Role,None)) if mediatype == "movie":
peoplesql="INSERT OR REPLACE into actorlinkmovie(idActor, idMovie, strRole, iOrder) values(?, ?, ?, ?)"
if mediatype == "tvshow":
peoplesql="INSERT OR REPLACE into actorlinktvshow(idActor, idShow, strRole, iOrder) values(?, ?, ?, ?)"
if mediatype == "episode":
peoplesql="INSERT OR REPLACE into actorlinkepisode(idActor, idEpisode, strRole, iOrder) values(?, ?, ?, ?)"
cursor.execute(peoplesql, (actorid,id,Role,None))
connection.commit() connection.commit()
#cursor.close() #cursor.close()