more krypton ratings

This commit is contained in:
im85288 2016-12-31 16:30:11 +00:00
parent aceecdfe5e
commit 835e95d3fd
3 changed files with 65 additions and 49 deletions

View file

@ -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.28" version="2.3.29"
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"/>

View file

@ -234,6 +234,18 @@ class Movies(Items):
} }
filename = "%s?%s" % (path, urllib.urlencode(params)) filename = "%s?%s" % (path, urllib.urlencode(params))
# 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)
# 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, movieid, "movie", imdb, "imdb")
##### UPDATE THE MOVIE ##### ##### UPDATE THE MOVIE #####
if update_item: if update_item:
@ -241,8 +253,8 @@ class Movies(Items):
# Update the movie entry # Update the movie entry
if self.kodi_version > 16: if self.kodi_version > 16:
self.kodi_db.update_movie_17(title, plot, shortplot, tagline, votecount, rating, self.kodi_db.update_movie_17(title, plot, shortplot, tagline, votecount, uniqueid,
writer, year, imdb, sorttitle, runtime, mpaa, genre, writer, year, uniqueid, sorttitle, runtime, mpaa, genre,
director, title, studio, trailer, country, year, director, title, studio, trailer, country, year,
movieid) movieid)
else: else:
@ -265,7 +277,7 @@ class Movies(Items):
# Create the movie entry # Create the movie entry
if self.kodi_version > 16: if self.kodi_version > 16:
self.kodi_db.add_movie_17(movieid, fileid, title, plot, shortplot, tagline, self.kodi_db.add_movie_17(movieid, fileid, title, plot, shortplot, tagline,
votecount, rating, writer, year, imdb, sorttitle, votecount, uniqueid, writer, year, uniqueid, sorttitle,
runtime, mpaa, genre, director, title, studio, trailer, runtime, mpaa, genre, director, title, studio, trailer,
country, year) country, year)
else: else:
@ -309,17 +321,6 @@ 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)
# 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, movieid, "movie", imdb, "imdb")
return True return True
def add_updateBoxset(self, boxset): def add_updateBoxset(self, boxset):

View file

@ -335,15 +335,29 @@ class TVShows(Items):
toplevelpath = "plugin://plugin.video.emby.tvshows/" toplevelpath = "plugin://plugin.video.emby.tvshows/"
path = "%s%s/" % (toplevelpath, itemid) path = "%s%s/" % (toplevelpath, itemid)
# 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")
##### UPDATE THE TVSHOW ##### ##### UPDATE THE TVSHOW #####
if update_item: if update_item:
log.info("UPDATE tvshow itemid: %s - Title: %s", itemid, title) log.info("UPDATE tvshow itemid: %s - Title: %s", itemid, title)
# Update the tvshow entry # Update the tvshow entry
self.kodi_db.update_tvshow(title, plot, rating, premieredate, genre, title, if self.kodi_version > 16:
tvdb, mpaa, studio, sorttitle, showid) self.kodi_db.update_tvshow(title, plot, uniqueid, premieredate, genre, title,
uniqueid, mpaa, studio, sorttitle, showid)
else:
self.kodi_db.update_tvshow(title, plot, rating, premieredate, genre, title,
tvdb, mpaa, studio, sorttitle, showid)
# Update the checksum in emby table # Update the checksum in emby table
emby_db.updateReference(itemid, checksum) emby_db.updateReference(itemid, checksum)
@ -359,8 +373,12 @@ class TVShows(Items):
pathid = self.kodi_db.add_path(path) pathid = self.kodi_db.add_path(path)
# Create the tvshow entry # Create the tvshow entry
self.kodi_db.add_tvshow(showid, title, plot, rating, premieredate, genre, if self.kodi_version > 16:
title, tvdb, mpaa, studio, sorttitle) self.kodi_db.add_tvshow(showid, title, plot, uniqueid, premieredate, genre,
title, uniqueid, mpaa, studio, sorttitle)
else:
self.kodi_db.add_tvshow(showid, title, plot, rating, premieredate, genre,
title, tvdb, mpaa, studio, sorttitle)
# Create the reference in emby table # Create the reference in emby table
emby_db.addReference(itemid, showid, "Series", "tvshow", pathid=pathid, emby_db.addReference(itemid, showid, "Series", "tvshow", pathid=pathid,
@ -404,18 +422,6 @@ 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):
@ -582,14 +588,30 @@ class TVShows(Items):
} }
filename = "%s?%s" % (path, urllib.urlencode(params)) filename = "%s?%s" % (path, urllib.urlencode(params))
# 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")
##### UPDATE THE EPISODE ##### ##### UPDATE THE EPISODE #####
if update_item: if update_item:
log.info("UPDATE episode itemid: %s - Title: %s", itemid, title) log.info("UPDATE episode itemid: %s - Title: %s", itemid, title)
# Update the movie entry # Update the episode entry
if self.kodi_version in (16, 17): if self.kodi_version > 16:
# Kodi Jarvis, Krypton # Kodi Krypton
self.kodi_db.update_episode_16(title, plot, uniqueid, writer, premieredate, runtime,
director, season, episode, title, airsBeforeSeason,
airsBeforeEpisode, seasonid, showid, episodeid)
elif self.kodi_version in 16:
# Kodi Jarvis
self.kodi_db.update_episode_16(title, plot, rating, writer, premieredate, runtime, self.kodi_db.update_episode_16(title, plot, rating, writer, premieredate, runtime,
director, season, episode, title, airsBeforeSeason, director, season, episode, title, airsBeforeSeason,
airsBeforeEpisode, seasonid, showid, episodeid) airsBeforeEpisode, seasonid, showid, episodeid)
@ -613,8 +635,13 @@ class TVShows(Items):
fileid = self.kodi_db.add_file(filename, pathid) fileid = self.kodi_db.add_file(filename, pathid)
# Create the episode entry # Create the episode entry
if self.kodi_version in (16, 17): if self.kodi_version > 16:
# Kodi Jarvis, Krypton # Kodi Krypton
self.kodi_db.add_episode_16(episodeid, fileid, title, plot, uniqueid, writer,
premieredate, runtime, director, season, episode, title,
showid, airsBeforeSeason, airsBeforeEpisode, seasonid)
elif self.kodi_version in 16:
# Kodi Jarvis
self.kodi_db.add_episode_16(episodeid, fileid, title, plot, rating, writer, self.kodi_db.add_episode_16(episodeid, fileid, title, plot, rating, writer,
premieredate, runtime, director, season, episode, title, premieredate, runtime, director, season, episode, title,
showid, airsBeforeSeason, airsBeforeEpisode, seasonid) showid, airsBeforeSeason, airsBeforeEpisode, seasonid)
@ -652,18 +679,6 @@ 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):