diff --git a/resources/lib/itemtypes/movies.py b/resources/lib/itemtypes/movies.py index 2c9655a9..1a49da2f 100644 --- a/resources/lib/itemtypes/movies.py +++ b/resources/lib/itemtypes/movies.py @@ -126,8 +126,7 @@ class Movie(ItemBase): rating, api.votecount()) if api.provider('imdb') is not None: - uniqueid = self.kodidb.get_uniqueid(kodi_id, - v.KODI_TYPE_MOVIE) + uniqueid = self.kodidb.add_uniqueid() self.kodidb.add_uniqueid(uniqueid, kodi_id, v.KODI_TYPE_MOVIE, diff --git a/resources/lib/kodi_db/video.py b/resources/lib/kodi_db/video.py index bb7abe33..19257e54 100644 --- a/resources/lib/kodi_db/video.py +++ b/resources/lib/kodi_db/video.py @@ -755,6 +755,10 @@ class KodiVideoDB(common.KodiDBBase): VALUES (?, ?, ?, ?, ?) ''', (args)) + def add_uniqueid(self): + self.cursor.execute('SELECT COALESCE(MAX(uniqueid_id), 0) FROM uniqueid') + return self.cursor.fetchone()[0] + 1 + def get_uniqueid(self, kodi_id, kodi_type): """ Returns the uniqueid_id @@ -764,8 +768,7 @@ class KodiVideoDB(common.KodiDBBase): try: return self.cursor.fetchone()[0] except TypeError: - self.cursor.execute('SELECT COALESCE(MAX(uniqueid_id),0) FROM uniqueid') - return self.cursor.fetchone()[0] + 1 + return self.add_uniqueid() def update_uniqueid(self, *args): """