diff --git a/jellyfin_kodi/objects/kodi/movies.py b/jellyfin_kodi/objects/kodi/movies.py index 40c442a1..0515f2e0 100644 --- a/jellyfin_kodi/objects/kodi/movies.py +++ b/jellyfin_kodi/objects/kodi/movies.py @@ -37,16 +37,6 @@ class Movies(Kodi): return self.cursor.fetchone()[0] + 1 - def create_entry_set(self): - self.cursor.execute(QU.create_set) - - return self.cursor.fetchone()[0] + 1 - - def create_entry_country(self): - self.cursor.execute(QU.create_country) - - return self.cursor.fetchone()[0] + 1 - def get(self, *args): try: @@ -114,11 +104,8 @@ class Movies(Kodi): self.cursor.execute(QU.update_country, (self.get_country(country),) + args) def add_country(self, *args): - - country_id = self.create_entry_country() - self.cursor.execute(QU.add_country, (country_id,) + args) - - return country_id + self.cursor.execute(QU.add_country, args) + return self.cursor.lastrowid def get_country(self, *args): @@ -130,11 +117,8 @@ class Movies(Kodi): return self.add_country(*args) def add_boxset(self, *args): - - set_id = self.create_entry_set() - self.cursor.execute(QU.add_set, (set_id,) + args) - - return set_id + self.cursor.execute(QU.add_set, args) + return self.cursor.lastrowid def update_boxset(self, *args): self.cursor.execute(QU.update_set, args) diff --git a/jellyfin_kodi/objects/kodi/queries.py b/jellyfin_kodi/objects/kodi/queries.py index 60d326b4..a9660c8a 100644 --- a/jellyfin_kodi/objects/kodi/queries.py +++ b/jellyfin_kodi/objects/kodi/queries.py @@ -44,14 +44,6 @@ create_movie = """ SELECT coalesce(max(idMovie), 0) FROM movie """ -create_set = """ -SELECT coalesce(max(idSet), 0) -FROM sets -""" -create_country = """ -SELECT coalesce(max(country_id), 0) -FROM country -""" create_musicvideo = """ SELECT coalesce(max(idMVideo), 0) FROM musicvideo @@ -319,12 +311,12 @@ add_unique_id_movie_obj = ["{Unique}", "{MovieId}", "movie", "{UniqueId}", "{Pro add_unique_id_tvshow_obj = ["{Unique}", "{ShowId}", "tvshow", "{UniqueId}", "{ProviderName}"] add_unique_id_episode_obj = ["{Unique}", "{EpisodeId}", "episode", "{UniqueId}", "{ProviderName}"] add_country = """ -INSERT INTO country(country_id, name) -VALUES (?, ?) +INSERT INTO country(name) +VALUES (?) """ add_set = """ -INSERT INTO sets(idSet, strSet, strOverview) -VALUES (?, ?, ?) +INSERT INTO sets(strSet, strOverview) +VALUES (?, ?) """ add_set_obj = ["{Title}", "{Overview}"] add_musicvideo = """