Get rid of Helix code
This commit is contained in:
parent
6ece9ab5cf
commit
e6631c3c78
1 changed files with 8 additions and 142 deletions
|
@ -367,148 +367,14 @@ class Kodidb_Functions():
|
|||
def addPeople(self, kodiid, people, mediatype):
|
||||
castorder = 0
|
||||
for person in people:
|
||||
# Kodi Isengard, Jarvis, Krypton
|
||||
if v.KODIVERSION > 14:
|
||||
actorid = self._getactorid(person['Name'])
|
||||
# Link person to content
|
||||
castorder = self._addPerson(person.get('Role'),
|
||||
person['Type'],
|
||||
actorid,
|
||||
kodiid,
|
||||
mediatype,
|
||||
castorder)
|
||||
# Kodi Helix
|
||||
else:
|
||||
query = ' '.join((
|
||||
|
||||
"SELECT idActor",
|
||||
"FROM actors",
|
||||
"WHERE strActor = ?",
|
||||
"COLLATE NOCASE"
|
||||
))
|
||||
self.cursor.execute(query, (person['Name'],))
|
||||
try:
|
||||
actorid = self.cursor.fetchone()[0]
|
||||
except TypeError:
|
||||
# Cast entry does not exists
|
||||
self.cursor.execute("select coalesce(max(idActor),0) from actors")
|
||||
actorid = self.cursor.fetchone()[0] + 1
|
||||
|
||||
query = "INSERT INTO actors(idActor, strActor) values(?, ?)"
|
||||
self.cursor.execute(query, (actorid, person['Name']))
|
||||
finally:
|
||||
# Link person to content
|
||||
if "Actor" == person['Type']:
|
||||
role = person.get('Role')
|
||||
|
||||
if "movie" in mediatype:
|
||||
query = (
|
||||
'''
|
||||
INSERT OR REPLACE INTO actorlinkmovie(
|
||||
idActor, idMovie, strRole, iOrder)
|
||||
|
||||
VALUES (?, ?, ?, ?)
|
||||
'''
|
||||
)
|
||||
elif "tvshow" in mediatype:
|
||||
query = (
|
||||
'''
|
||||
INSERT OR REPLACE INTO actorlinktvshow(
|
||||
idActor, idShow, strRole, iOrder)
|
||||
|
||||
VALUES (?, ?, ?, ?)
|
||||
'''
|
||||
)
|
||||
elif "episode" in mediatype:
|
||||
query = (
|
||||
'''
|
||||
INSERT OR REPLACE INTO actorlinkepisode(
|
||||
idActor, idEpisode, strRole, iOrder)
|
||||
|
||||
VALUES (?, ?, ?, ?)
|
||||
'''
|
||||
)
|
||||
else:
|
||||
# Item is invalid
|
||||
return
|
||||
self.cursor.execute(query, (actorid, kodiid, role, castorder))
|
||||
castorder += 1
|
||||
|
||||
elif "Director" == person['Type']:
|
||||
if "movie" in mediatype:
|
||||
query = (
|
||||
'''
|
||||
INSERT OR REPLACE INTO directorlinkmovie(
|
||||
idDirector, idMovie)
|
||||
|
||||
VALUES (?, ?)
|
||||
'''
|
||||
)
|
||||
elif "tvshow" in mediatype:
|
||||
query = (
|
||||
'''
|
||||
INSERT OR REPLACE INTO directorlinktvshow(
|
||||
idDirector, idShow)
|
||||
|
||||
VALUES (?, ?)
|
||||
'''
|
||||
)
|
||||
elif "musicvideo" in mediatype:
|
||||
query = (
|
||||
'''
|
||||
INSERT OR REPLACE INTO directorlinkmusicvideo(
|
||||
idDirector, idMVideo)
|
||||
|
||||
VALUES (?, ?)
|
||||
'''
|
||||
)
|
||||
|
||||
elif "episode" in mediatype:
|
||||
query = (
|
||||
'''
|
||||
INSERT OR REPLACE INTO directorlinkepisode(
|
||||
idDirector, idEpisode)
|
||||
|
||||
VALUES (?, ?)
|
||||
'''
|
||||
)
|
||||
else: return # Item is invalid
|
||||
|
||||
self.cursor.execute(query, (actorid, kodiid))
|
||||
|
||||
elif person['Type'] == "Writer":
|
||||
if "movie" in mediatype:
|
||||
query = (
|
||||
'''
|
||||
INSERT OR REPLACE INTO writerlinkmovie(
|
||||
idWriter, idMovie)
|
||||
|
||||
VALUES (?, ?)
|
||||
'''
|
||||
)
|
||||
elif "episode" in mediatype:
|
||||
query = (
|
||||
'''
|
||||
INSERT OR REPLACE INTO writerlinkepisode(
|
||||
idWriter, idEpisode)
|
||||
|
||||
VALUES (?, ?)
|
||||
'''
|
||||
)
|
||||
else:
|
||||
# Item is invalid
|
||||
return
|
||||
self.cursor.execute(query, (actorid, kodiid))
|
||||
elif "Artist" == person['Type']:
|
||||
query = (
|
||||
'''
|
||||
INSERT OR REPLACE INTO artistlinkmusicvideo(
|
||||
idArtist, idMVideo)
|
||||
VALUES (?, ?)
|
||||
'''
|
||||
)
|
||||
self.cursor.execute(query, (actorid, kodiid))
|
||||
|
||||
actorid = self._getactorid(person['Name'])
|
||||
# Link person to content
|
||||
castorder = self._addPerson(person.get('Role'),
|
||||
person['Type'],
|
||||
actorid,
|
||||
kodiid,
|
||||
mediatype,
|
||||
castorder)
|
||||
# Add person image to art table
|
||||
if person['imageurl']:
|
||||
self.artwork.addOrUpdateArt(person['imageurl'], actorid,
|
||||
|
|
Loading…
Reference in a new issue