diff --git a/addon.xml b/addon.xml index 54b5762b..c23e5312 100644 --- a/addon.xml +++ b/addon.xml @@ -1,7 +1,7 @@ diff --git a/resources/lib/objects/_kodi_movies.py b/resources/lib/objects/_kodi_movies.py index ecfda1f6..58f82456 100644 --- a/resources/lib/objects/_kodi_movies.py +++ b/resources/lib/objects/_kodi_movies.py @@ -21,6 +21,12 @@ class KodiMovies(KodiItems): KodiItems.__init__(self) + def create_entry_uniqueid(self): + self.cursor.execute("select coalesce(max(uniqueid_id),0) from uniqueid") + kodi_id = self.cursor.fetchone()[0] + 1 + + return kodi_id + def create_entry_rating(self): self.cursor.execute("select coalesce(max(rating_id),0) from rating") kodi_id = self.cursor.fetchone()[0] + 1 @@ -128,6 +134,26 @@ class KodiMovies(KodiItems): )) self.cursor.execute(query, (args)) + def add_uniqueid(self, *args): + query = ( + ''' + INSERT INTO uniqueid( + uniqueid_id, media_id, media_type, value, type) + + VALUES (?, ?, ?, ?, ?) + ''' + ) + self.cursor.execute(query, (args)) + + def update_uniqueid(self, *args): + query = ' '.join(( + + "UPDATE uniqueid", + "SET media_id = ?, media_type = ?, value = ?, type = ?", + "WHERE uniqueid_id = ?" + )) + self.cursor.execute(query, (args)) + def add_countries(self, kodi_id, countries): if self.kodi_version > 14: diff --git a/resources/lib/objects/movies.py b/resources/lib/objects/movies.py index eb657041..322b90bb 100644 --- a/resources/lib/objects/movies.py +++ b/resources/lib/objects/movies.py @@ -315,6 +315,11 @@ class Movies(Items): self.kodi_db.add_ratings(ratingid, movieid, "movie", "default", rating, votecount) + # update new uniqueid Kodi 17 - todo get uniqueid_id for updates from embydb + if self.kodi_version > 16: + uniqueid = self.kodi_db.create_entry_uniqueid() + + self.kodi_db.add_uniqueid(uniqueid, movieid, "movie", imdb, "imdb") return True def add_updateBoxset(self, boxset):