Fix getting unique id

This commit is contained in:
tomkat83 2017-02-13 20:26:30 +01:00
parent 9612ee78ab
commit 922f4150a0
2 changed files with 11 additions and 6 deletions

View file

@ -323,7 +323,8 @@ class Movies(Items):
votecount,
ratingid)
# update new uniqueid Kodi 17
uniqueid = self.kodi_db.get_uniqueid(movieid)
uniqueid = self.kodi_db.get_uniqueid(movieid,
v.KODI_TYPE_MOVIE)
self.kodi_db.update_uniqueid(movieid,
v.KODI_TYPE_MOVIE,
imdb,
@ -605,7 +606,7 @@ class TVShows(Items):
None, # votecount
ratingid)
# update new uniqueid Kodi 17
uniqueid = self.kodi_db.get_uniqueid(showid)
uniqueid = self.kodi_db.get_uniqueid(showid, v.KODI_TYPE_SHOW)
self.kodi_db.update_uniqueid(showid,
v.KODI_TYPE_SHOW,
tvdb,
@ -927,7 +928,8 @@ class TVShows(Items):
votecount,
ratingid)
# update new uniqueid Kodi 17
uniqueid = self.kodi_db.get_uniqueid(episodeid)
uniqueid = self.kodi_db.get_uniqueid(episodeid,
v.KODI_TYPE_EPISODE)
self.kodi_db.update_uniqueid(episodeid,
v.KODI_TYPE_EPISODE,
tvdb,

View file

@ -1434,9 +1434,12 @@ class Kodidb_Functions():
'''
self.cursor.execute(query, (args))
def get_uniqueid(self, media_id):
query = "SELECT uniqueid_id FROM uniqueid WHERE media_id = ?"
self.cursor.execute(query, (media_id,))
def get_uniqueid(self, kodi_id, kodi_type):
query = '''
SELECT uniqueid_id FROM uniqueid
WHERE media_id = ? AND media_type = ?
'''
self.cursor.execute(query, (kodi_id, kodi_type))
try:
uniqueid = self.cursor.fetchone()[0]
except TypeError: