Fix getting the rating id
This commit is contained in:
parent
aa5cb37a8f
commit
9612ee78ab
2 changed files with 11 additions and 6 deletions
|
@ -314,7 +314,8 @@ class Movies(Items):
|
||||||
# Update the movie entry
|
# Update the movie entry
|
||||||
if v.KODIVERSION >= 17:
|
if v.KODIVERSION >= 17:
|
||||||
# update new ratings Kodi 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,
|
self.kodi_db.update_ratings(movieid,
|
||||||
v.KODI_TYPE_MOVIE,
|
v.KODI_TYPE_MOVIE,
|
||||||
"default",
|
"default",
|
||||||
|
@ -596,7 +597,7 @@ class TVShows(Items):
|
||||||
% (itemid, title))
|
% (itemid, title))
|
||||||
if v.KODIVERSION >= 17:
|
if v.KODIVERSION >= 17:
|
||||||
# update new ratings Kodi 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,
|
self.kodi_db.update_ratings(showid,
|
||||||
v.KODI_TYPE_SHOW,
|
v.KODI_TYPE_SHOW,
|
||||||
"default",
|
"default",
|
||||||
|
@ -917,7 +918,8 @@ class TVShows(Items):
|
||||||
# Update the movie entry
|
# Update the movie entry
|
||||||
if v.KODIVERSION >= 17:
|
if v.KODIVERSION >= 17:
|
||||||
# update new ratings Kodi 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,
|
self.kodi_db.update_ratings(episodeid,
|
||||||
v.KODI_TYPE_EPISODE,
|
v.KODI_TYPE_EPISODE,
|
||||||
"default",
|
"default",
|
||||||
|
|
|
@ -1465,9 +1465,12 @@ class Kodidb_Functions():
|
||||||
self.cursor.execute("select coalesce(max(rating_id),0) from rating")
|
self.cursor.execute("select coalesce(max(rating_id),0) from rating")
|
||||||
return self.cursor.fetchone()[0] + 1
|
return self.cursor.fetchone()[0] + 1
|
||||||
|
|
||||||
def get_ratingid(self, media_id):
|
def get_ratingid(self, kodi_id, kodi_type):
|
||||||
query = "SELECT rating_id FROM rating WHERE media_id = ?"
|
query = '''
|
||||||
self.cursor.execute(query, (media_id,))
|
SELECT rating_id FROM rating
|
||||||
|
WHERE media_id = ? AND media_type = ?
|
||||||
|
'''
|
||||||
|
self.cursor.execute(query, (kodi_id, kodi_type))
|
||||||
try:
|
try:
|
||||||
ratingid = self.cursor.fetchone()[0]
|
ratingid = self.cursor.fetchone()[0]
|
||||||
except TypeError:
|
except TypeError:
|
||||||
|
|
Loading…
Reference in a new issue