mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-12-25 10:16:11 +00:00
add episodes/tvshows uniqueid/rating
This commit is contained in:
parent
87501eedea
commit
aceecdfe5e
3 changed files with 82 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.27"
|
version="2.3.28"
|
||||||
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,19 @@ class KodiTVShows(KodiItems):
|
||||||
|
|
||||||
KodiItems.__init__(self)
|
KodiItems.__init__(self)
|
||||||
|
|
||||||
|
def create_entry_uniqueid(self):
|
||||||
|
self.cursor.execute("select coalesce(max(uniqueid_id),0) from uniqueid")
|
||||||
|
kodi_id = self.cursor.fetchone()[0] + 1
|
||||||
|
|
||||||
|
return kodi_id
|
||||||
|
|
||||||
|
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(idShow),0) from tvshow")
|
self.cursor.execute("select coalesce(max(idShow),0) from tvshow")
|
||||||
kodi_id = self.cursor.fetchone()[0] + 1
|
kodi_id = self.cursor.fetchone()[0] + 1
|
||||||
|
@ -61,6 +74,46 @@ class KodiTVShows(KodiItems):
|
||||||
|
|
||||||
return kodi_id
|
return kodi_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_uniqueid(self, *args):
|
||||||
|
query = (
|
||||||
|
'''
|
||||||
|
INSERT INTO uniqueid(
|
||||||
|
uniqueid_id, media_id, media_type, value, type)
|
||||||
|
|
||||||
|
VALUES (?, ?, ?, ?, ?)
|
||||||
|
'''
|
||||||
|
)
|
||||||
|
self.cursor.execute(query, (args))
|
||||||
|
|
||||||
|
def update_uniqueid(self, *args):
|
||||||
|
query = ' '.join((
|
||||||
|
|
||||||
|
"UPDATE uniqueid",
|
||||||
|
"SET media_id = ?, media_type = ?, value = ?, type = ?",
|
||||||
|
"WHERE uniqueid_id = ?"
|
||||||
|
))
|
||||||
|
self.cursor.execute(query, (args))
|
||||||
|
|
||||||
def add_tvshow(self, *args):
|
def add_tvshow(self, *args):
|
||||||
|
|
||||||
query = (
|
query = (
|
||||||
|
|
|
@ -281,6 +281,7 @@ class TVShows(Items):
|
||||||
title = item['Name']
|
title = item['Name']
|
||||||
plot = API.get_overview()
|
plot = API.get_overview()
|
||||||
rating = item.get('CommunityRating')
|
rating = item.get('CommunityRating')
|
||||||
|
votecount = item.get('VoteCount')
|
||||||
premieredate = API.get_premiere_date()
|
premieredate = API.get_premiere_date()
|
||||||
tvdb = API.get_provider('Tvdb')
|
tvdb = API.get_provider('Tvdb')
|
||||||
sorttitle = item['SortName']
|
sorttitle = item['SortName']
|
||||||
|
@ -403,6 +404,18 @@ class TVShows(Items):
|
||||||
all_episodes = emby.getEpisodesbyShow(itemid)
|
all_episodes = emby.getEpisodesbyShow(itemid)
|
||||||
self.add_episodes(all_episodes['Items'], None)
|
self.add_episodes(all_episodes['Items'], None)
|
||||||
|
|
||||||
|
# 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, showid, "tvshow", "default", rating, votecount)
|
||||||
|
|
||||||
|
# update new uniqueid Kodi 17 - todo get uniqueid_id for updates from embydb
|
||||||
|
if self.kodi_version > 16:
|
||||||
|
uniqueid = self.kodi_db.create_entry_uniqueid()
|
||||||
|
|
||||||
|
self.kodi_db.add_uniqueid(uniqueid, showid, "tvshow", tvdb, "tvdb")
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def add_updateSeason(self, item, showid=None):
|
def add_updateSeason(self, item, showid=None):
|
||||||
|
@ -489,6 +502,9 @@ class TVShows(Items):
|
||||||
runtime = API.get_runtime()
|
runtime = API.get_runtime()
|
||||||
premieredate = API.get_premiere_date()
|
premieredate = API.get_premiere_date()
|
||||||
|
|
||||||
|
votecount = item.get('VoteCount')
|
||||||
|
tvdb = API.get_provider('Tvdb')
|
||||||
|
|
||||||
# episode details
|
# episode details
|
||||||
try:
|
try:
|
||||||
seriesId = item['SeriesId']
|
seriesId = item['SeriesId']
|
||||||
|
@ -636,6 +652,18 @@ class TVShows(Items):
|
||||||
self.kodi_db.update_file(tempfileid, filename, temppathid, dateadded)
|
self.kodi_db.update_file(tempfileid, filename, temppathid, dateadded)
|
||||||
self.kodi_db.add_playstate(tempfileid, resume, total, playcount, dateplayed)
|
self.kodi_db.add_playstate(tempfileid, 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, showid, "episode", "default", rating, votecount)
|
||||||
|
|
||||||
|
# update new uniqueid Kodi 17 - todo get uniqueid_id for updates from embydb
|
||||||
|
if self.kodi_version > 16:
|
||||||
|
uniqueid = self.kodi_db.create_entry_uniqueid()
|
||||||
|
|
||||||
|
self.kodi_db.add_uniqueid(uniqueid, showid, "episode", tvdb, "tvdb")
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def updateUserdata(self, item):
|
def updateUserdata(self, item):
|
||||||
|
|
Loading…
Reference in a new issue