start of kodi ratings

This commit is contained in:
im85288 2016-12-29 18:55:31 +00:00
parent 6a1b574631
commit 863919d696
3 changed files with 34 additions and 1 deletions

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="plugin.video.emby"
name="Emby"
version="2.3.25"
version="2.3.26"
provider-name="Emby.media">
<requires>
<import addon="xbmc.python" version="2.19.0"/>

View file

@ -21,6 +21,12 @@ class KodiMovies(KodiItems):
KodiItems.__init__(self)
def create_entry_rating(self):
self.cursor.execute("select coalesce(max(rating_id),0) from rating")
kodi_id = self.cursor.fetchone()[0] + 1
return kodi_id
def create_entry(self):
self.cursor.execute("select coalesce(max(idMovie),0) from movie")
kodi_id = self.cursor.fetchone()[0] + 1
@ -101,6 +107,27 @@ class KodiMovies(KodiItems):
self.cursor.execute("DELETE FROM movie WHERE idMovie = ?", (kodi_id,))
self.cursor.execute("DELETE FROM files WHERE idFile = ?", (file_id,))
def add_ratings(self, *args):
query = (
'''
INSERT INTO rating(
rating_id, media_id, media_type, rating_type, rating, votes)
VALUES (?, ?, ?, ?, ?, ?)
'''
)
self.cursor.execute(query, (args))
def update_ratings(self, *args):
query = ' '.join((
"UPDATE rating",
"SET media_id = ?, media_type = ?, rating_type = ?, rating = ?, votes = ?",
"WHERE rating_id = ?"
))
self.cursor.execute(query, (args))
def add_countries(self, kodi_id, countries):
if self.kodi_version > 14:

View file

@ -309,6 +309,12 @@ class Movies(Items):
total = round(float(runtime), 6)
self.kodi_db.add_playstate(fileid, resume, total, playcount, dateplayed)
# update new ratings Kodi 17 - todo get ratingid for updates from embydb
if self.kodi_version > 16:
ratingid = self.kodi_db.create_entry_rating()
self.kodi_db.add_ratings(ratingid, movieid, "movie", "default", rating, votecount)
return True
def add_updateBoxset(self, boxset):