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,17 +1306,38 @@ 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)
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,)) 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:
if kodiVersion == 15:
# Kodi Isengard database #
cursor.execute("select coalesce(max(actor_id),0) as actorid from actor")
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") cursor.execute("select coalesce(max(idActor),0) as actorid from actors")
actorid = cursor.fetchone()[0] actorid = cursor.fetchone()[0]
actorid = actorid + 1 actorid = actorid + 1
peoplesql="insert into actors(idActor, strActor, strThumb) values(?, ?, ?)" peoplesql="insert into actors(idActor, strActor, strThumb) values(?, ?, ?)"
cursor.execute(peoplesql, (actorid,Name,Thumb)) cursor.execute(peoplesql, (actorid,Name,Thumb))
if kodiVersion == 15:
# Kodi Isengard database #
peoplesql="INSERT OR REPLACE into actor_link(actor_id, media_id, media_type, role, cast_order) values(?, ?, ?, ?, ?)"
cursor.execute(peoplesql, (actorid, id, mediatype, Role, None))
else:
# Kodi Gotham or Helix database #
if mediatype == "movie": if mediatype == "movie":
peoplesql="INSERT OR REPLACE into actorlinkmovie(idActor, idMovie, strRole, iOrder) values(?, ?, ?, ?)" peoplesql="INSERT OR REPLACE into actorlinkmovie(idActor, idMovie, strRole, iOrder) values(?, ?, ?, ?)"
if mediatype == "tvshow": if mediatype == "tvshow":