Dedicated DB method to add video rating_id
This commit is contained in:
parent
3acaad5663
commit
70a6ee5ed6
2 changed files with 6 additions and 4 deletions
|
@ -118,8 +118,7 @@ class Movie(ItemBase):
|
||||||
file_id = self.kodidb.add_file(filename,
|
file_id = self.kodidb.add_file(filename,
|
||||||
kodi_pathid,
|
kodi_pathid,
|
||||||
api.date_created())
|
api.date_created())
|
||||||
rating_id = self.kodidb.get_ratingid(kodi_id,
|
rating_id = self.kodidb.add_ratingid()
|
||||||
v.KODI_TYPE_MOVIE)
|
|
||||||
self.kodidb.add_ratings(rating_id,
|
self.kodidb.add_ratings(rating_id,
|
||||||
kodi_id,
|
kodi_id,
|
||||||
v.KODI_TYPE_MOVIE,
|
v.KODI_TYPE_MOVIE,
|
||||||
|
|
|
@ -784,6 +784,10 @@ class KodiVideoDB(common.KodiDBBase):
|
||||||
self.cursor.execute('DELETE FROM uniqueid WHERE media_id = ? AND media_type = ?',
|
self.cursor.execute('DELETE FROM uniqueid WHERE media_id = ? AND media_type = ?',
|
||||||
(kodi_id, kodi_type))
|
(kodi_id, kodi_type))
|
||||||
|
|
||||||
|
def add_ratingid(self):
|
||||||
|
self.cursor.execute('SELECT COALESCE(MAX(rating_id),0) FROM rating')
|
||||||
|
return self.cursor.fetchone()[0] + 1
|
||||||
|
|
||||||
def get_ratingid(self, kodi_id, kodi_type):
|
def get_ratingid(self, kodi_id, kodi_type):
|
||||||
"""
|
"""
|
||||||
Create if needed and return the unique rating_id from rating table
|
Create if needed and return the unique rating_id from rating table
|
||||||
|
@ -793,8 +797,7 @@ class KodiVideoDB(common.KodiDBBase):
|
||||||
try:
|
try:
|
||||||
return self.cursor.fetchone()[0]
|
return self.cursor.fetchone()[0]
|
||||||
except TypeError:
|
except TypeError:
|
||||||
self.cursor.execute('SELECT COALESCE(MAX(rating_id),0) FROM rating')
|
return self.add_ratingid()
|
||||||
return self.cursor.fetchone()[0] + 1
|
|
||||||
|
|
||||||
def update_ratings(self, *args):
|
def update_ratings(self, *args):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in a new issue