diff --git a/resources/lib/itemtypes.py b/resources/lib/itemtypes.py index f2b92b70..1b265cc1 100644 --- a/resources/lib/itemtypes.py +++ b/resources/lib/itemtypes.py @@ -314,7 +314,8 @@ class Movies(Items): # Update the movie entry if v.KODIVERSION >= 17: # update new ratings Kodi 17 - ratingid = self.kodi_db.get_ratingid(movieid) + ratingid = self.kodi_db.get_ratingid(movieid, + v.KODI_TYPE_MOVIE) self.kodi_db.update_ratings(movieid, v.KODI_TYPE_MOVIE, "default", @@ -596,7 +597,7 @@ class TVShows(Items): % (itemid, title)) if v.KODIVERSION >= 17: # update new ratings Kodi 17 - ratingid = self.kodi_db.get_ratingid(showid) + ratingid = self.kodi_db.get_ratingid(showid, v.KODI_TYPE_SHOW) self.kodi_db.update_ratings(showid, v.KODI_TYPE_SHOW, "default", @@ -917,7 +918,8 @@ class TVShows(Items): # Update the movie entry if v.KODIVERSION >= 17: # update new ratings Kodi 17 - ratingid = self.kodi_db.get_ratingid(episodeid) + ratingid = self.kodi_db.get_ratingid(episodeid, + v.KODI_TYPE_EPISODE) self.kodi_db.update_ratings(episodeid, v.KODI_TYPE_EPISODE, "default", diff --git a/resources/lib/kodidb_functions.py b/resources/lib/kodidb_functions.py index ac14853b..7f5262fa 100644 --- a/resources/lib/kodidb_functions.py +++ b/resources/lib/kodidb_functions.py @@ -1465,9 +1465,12 @@ class Kodidb_Functions(): self.cursor.execute("select coalesce(max(rating_id),0) from rating") return self.cursor.fetchone()[0] + 1 - def get_ratingid(self, media_id): - query = "SELECT rating_id FROM rating WHERE media_id = ?" - self.cursor.execute(query, (media_id,)) + def get_ratingid(self, kodi_id, kodi_type): + query = ''' + SELECT rating_id FROM rating + WHERE media_id = ? AND media_type = ? + ''' + self.cursor.execute(query, (kodi_id, kodi_type)) try: ratingid = self.cursor.fetchone()[0] except TypeError: