mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-12-25 10:16:11 +00:00
start of kodi ratings
This commit is contained in:
parent
6a1b574631
commit
863919d696
3 changed files with 34 additions and 1 deletions
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||||
<addon id="plugin.video.emby"
|
<addon id="plugin.video.emby"
|
||||||
name="Emby"
|
name="Emby"
|
||||||
version="2.3.25"
|
version="2.3.26"
|
||||||
provider-name="Emby.media">
|
provider-name="Emby.media">
|
||||||
<requires>
|
<requires>
|
||||||
<import addon="xbmc.python" version="2.19.0"/>
|
<import addon="xbmc.python" version="2.19.0"/>
|
||||||
|
|
|
@ -21,6 +21,12 @@ class KodiMovies(KodiItems):
|
||||||
|
|
||||||
KodiItems.__init__(self)
|
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):
|
def create_entry(self):
|
||||||
self.cursor.execute("select coalesce(max(idMovie),0) from movie")
|
self.cursor.execute("select coalesce(max(idMovie),0) from movie")
|
||||||
kodi_id = self.cursor.fetchone()[0] + 1
|
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 movie WHERE idMovie = ?", (kodi_id,))
|
||||||
self.cursor.execute("DELETE FROM files WHERE idFile = ?", (file_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):
|
def add_countries(self, kodi_id, countries):
|
||||||
|
|
||||||
if self.kodi_version > 14:
|
if self.kodi_version > 14:
|
||||||
|
|
|
@ -309,6 +309,12 @@ class Movies(Items):
|
||||||
total = round(float(runtime), 6)
|
total = round(float(runtime), 6)
|
||||||
self.kodi_db.add_playstate(fileid, resume, total, playcount, dateplayed)
|
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
|
return True
|
||||||
|
|
||||||
def add_updateBoxset(self, boxset):
|
def add_updateBoxset(self, boxset):
|
||||||
|
|
Loading…
Reference in a new issue