Fixed uniqueID and ratingID issues (#95)

* Fixed uniqueID and ratingID issues

* cleanup
This commit is contained in:
Sebastian S 2017-06-27 09:28:06 +02:00 committed by angelblue05
parent 21e7a9cada
commit 71da2bf777
4 changed files with 16 additions and 16 deletions

View file

@ -115,8 +115,8 @@ class KodiMovies(KodiItems):
def get_ratingid(self, media_id): def get_ratingid(self, media_id):
query = "SELECT rating_id FROM rating WHERE media_id = ?" query = "SELECT rating_id FROM rating WHERE media_type = ? AND media_id = ?"
self.cursor.execute(query, (media_id,)) self.cursor.execute(query, ("movie", media_id,))
try: try:
ratingid = self.cursor.fetchone()[0] ratingid = self.cursor.fetchone()[0]
except TypeError: except TypeError:
@ -146,8 +146,8 @@ class KodiMovies(KodiItems):
def get_uniqueid(self, media_id): def get_uniqueid(self, media_id):
query = "SELECT uniqueid_id FROM uniqueid WHERE media_id = ?" query = "SELECT uniqueid_id FROM uniqueid WHERE media_type = ? AND media_id = ?"
self.cursor.execute(query, (media_id,)) self.cursor.execute(query, ("movie", media_id,))
try: try:
uniqueid = self.cursor.fetchone()[0] uniqueid = self.cursor.fetchone()[0]
except TypeError: except TypeError:

View file

@ -74,10 +74,10 @@ class KodiTVShows(KodiItems):
return kodi_id return kodi_id
def get_ratingid(self, media_id): def get_ratingid(self, media_type, media_id):
query = "SELECT rating_id FROM rating WHERE media_id = ?" query = "SELECT rating_id FROM rating WHERE media_type = ? AND media_id = ?"
self.cursor.execute(query, (media_id,)) self.cursor.execute(query, (media_type, media_id,))
try: try:
ratingid = self.cursor.fetchone()[0] ratingid = self.cursor.fetchone()[0]
except TypeError: except TypeError:
@ -105,10 +105,10 @@ class KodiTVShows(KodiItems):
)) ))
self.cursor.execute(query, (args)) self.cursor.execute(query, (args))
def get_uniqueid(self, media_id): def get_uniqueid(self, media_type, media_id):
query = "SELECT uniqueid_id FROM uniqueid WHERE media_id = ?" query = "SELECT uniqueid_id FROM uniqueid WHERE media_type = ? AND media_id = ?"
self.cursor.execute(query, (media_id,)) self.cursor.execute(query, (media_type, media_id,))
try: try:
uniqueid = self.cursor.fetchone()[0] uniqueid = self.cursor.fetchone()[0]
except TypeError: except TypeError:

View file

@ -243,13 +243,13 @@ class Movies(Items):
if self.kodi_version >= 17: if self.kodi_version >= 17:
ratingid = self.kodi_db.get_ratingid(movieid) ratingid = self.kodi_db.get_ratingid(movieid)
self.kodi_db.update_ratings(movieid, "movie", "default", rating, votecount,ratingid) self.kodi_db.update_ratings(movieid, "movie", "default", rating, votecount, ratingid)
# update new uniqueid Kodi 17 # update new uniqueid Kodi 17
if self.kodi_version >= 17: if self.kodi_version >= 17:
uniqueid = self.kodi_db.get_uniqueid(movieid) uniqueid = self.kodi_db.get_uniqueid(movieid)
self.kodi_db.update_uniqueid(movieid, "movie", imdb, "imdb",uniqueid) self.kodi_db.update_uniqueid(movieid, "movie", imdb, "imdb", uniqueid)
# Update the movie entry # Update the movie entry
if self.kodi_version >= 17: if self.kodi_version >= 17:

View file

@ -344,13 +344,13 @@ class TVShows(Items):
# update new ratings Kodi 17 # update new ratings Kodi 17
if self.kodi_version > 16: if self.kodi_version > 16:
ratingid = self.kodi_db.get_ratingid(showid) ratingid = self.kodi_db.get_ratingid("tvshow", showid)
self.kodi_db.update_ratings(showid, "tvshow", "default", rating, votecount,ratingid) self.kodi_db.update_ratings(showid, "tvshow", "default", rating, votecount,ratingid)
# update new uniqueid Kodi 17 # update new uniqueid Kodi 17
if self.kodi_version > 16: if self.kodi_version > 16:
uniqueid = self.kodi_db.get_uniqueid(showid) uniqueid = self.kodi_db.get_uniqueid("tvshow", showid)
self.kodi_db.update_uniqueid(showid, "tvshow", imdb, "imdb",uniqueid) self.kodi_db.update_uniqueid(showid, "tvshow", imdb, "imdb",uniqueid)
@ -609,13 +609,13 @@ class TVShows(Items):
# update new ratings Kodi 17 # update new ratings Kodi 17
if self.kodi_version >= 17: if self.kodi_version >= 17:
ratingid = self.kodi_db.get_ratingid(episodeid) ratingid = self.kodi_db.get_ratingid("episode", episodeid)
self.kodi_db.update_ratings(episodeid, "episode", "default", rating, votecount,ratingid) self.kodi_db.update_ratings(episodeid, "episode", "default", rating, votecount,ratingid)
# update new uniqueid Kodi 17 # update new uniqueid Kodi 17
if self.kodi_version >= 17: if self.kodi_version >= 17:
uniqueid = self.kodi_db.get_uniqueid(episodeid) uniqueid = self.kodi_db.get_uniqueid("episode", episodeid)
self.kodi_db.update_uniqueid(episodeid, "episode", tvdb, "tvdb",uniqueid) self.kodi_db.update_uniqueid(episodeid, "episode", tvdb, "tvdb",uniqueid)