diff --git a/jellyfin_kodi/objects/kodi/kodi.py b/jellyfin_kodi/objects/kodi/kodi.py index dd613089..f1182027 100644 --- a/jellyfin_kodi/objects/kodi/kodi.py +++ b/jellyfin_kodi/objects/kodi/kodi.py @@ -40,11 +40,6 @@ class Kodi(object): return self.cursor.fetchone()[0] + 1 - def create_entry_person(self): - self.cursor.execute(QU.create_person) - - return self.cursor.fetchone()[0] + 1 - def create_entry_genre(self): self.cursor.execute(QU.create_genre) @@ -164,8 +159,8 @@ class Kodi(object): def add_person(self, *args): - person_id = self.create_entry_person() - self.cursor.execute(QU.add_person, (person_id,) + args) + self.cursor.execute(QU.add_person, args) + return self.cursor.lastrowid return person_id diff --git a/jellyfin_kodi/objects/kodi/queries.py b/jellyfin_kodi/objects/kodi/queries.py index a9660c8a..e5ca2301 100644 --- a/jellyfin_kodi/objects/kodi/queries.py +++ b/jellyfin_kodi/objects/kodi/queries.py @@ -12,10 +12,6 @@ create_file = """ SELECT coalesce(max(idFile), 0) FROM files """ -create_person = """ -SELECT coalesce(max(actor_id), 0) -FROM actor -""" create_genre = """ SELECT coalesce(max(genre_id), 0) FROM genre @@ -225,8 +221,8 @@ VALUES (?, ?, ?) """ add_file_obj = ["{PathId}", "{Filename}"] add_person = """ -INSERT INTO actor(actor_id, name) -VALUES (?, ?) +INSERT INTO actor(name) +VALUES (?) """ add_people_movie_obj = ["{People}", "{MovieId}", "movie"] add_people_mvideo_obj = ["{People}", "{MvideoId}", "musicvideo"]