From e6631c3c78987608e76be60de14a23fcbbca27c0 Mon Sep 17 00:00:00 2001 From: croneter Date: Fri, 23 Feb 2018 16:10:52 +0100 Subject: [PATCH] Get rid of Helix code --- resources/lib/kodidb_functions.py | 150 ++---------------------------- 1 file changed, 8 insertions(+), 142 deletions(-) diff --git a/resources/lib/kodidb_functions.py b/resources/lib/kodidb_functions.py index ab3609de..3612bf3b 100644 --- a/resources/lib/kodidb_functions.py +++ b/resources/lib/kodidb_functions.py @@ -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,