3.0.0 Revision Krypton

Update playback for Krytpon
Support Multi source
Add Force Transcode
Add a small listener for external players
Update dialog skin (thank you sualfred)
This commit is contained in:
angelblue05 2018-01-07 20:13:11 -06:00 committed by GitHub
parent 6005555b37
commit 9ac37a1c40
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
56 changed files with 2679 additions and 2378 deletions

View file

@ -63,18 +63,6 @@ class KodiMovies(KodiItems):
return kodi_id
def add_movie(self, *args):
query = (
'''
INSERT INTO movie(
idMovie, idFile, c00, c01, c02, c03, c04, c05, c06, c07,
c09, c10, c11, c12, c14, c15, c16, c18, c19, c21)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
'''
)
self.cursor.execute(query, (args))
def add_movie_17(self, *args):
# Create the movie entry
query = (
'''
@ -88,17 +76,6 @@ class KodiMovies(KodiItems):
self.cursor.execute(query, (args))
def update_movie(self, *args):
query = ' '.join((
"UPDATE movie",
"SET c00 = ?, c01 = ?, c02 = ?, c03 = ?, c04 = ?, c05 = ?, c06 = ?,",
"c07 = ?, c09 = ?, c10 = ?, c11 = ?, c12 = ?, c14 = ?, c15 = ?,",
"c16 = ?, c18 = ?, c19 = ?, c21 = ?",
"WHERE idMovie = ?"
))
self.cursor.execute(query, (args))
def update_movie_17(self, *args):
query = ' '.join((
"UPDATE movie",
@ -177,48 +154,16 @@ class KodiMovies(KodiItems):
def add_countries(self, kodi_id, countries):
if self.kodi_version > 14:
for country in countries:
country_id = self._get_country(country)
for country in countries:
country_id = self._get_country(country)
query = (
'''
INSERT OR REPLACE INTO country_link(country_id, media_id, media_type)
VALUES (?, ?, ?)
'''
)
self.cursor.execute(query, (country_id, kodi_id, "movie"))
else:
# TODO: Remove Helix code when Krypton is RC
for country in countries:
query = ' '.join((
"SELECT idCountry",
"FROM country",
"WHERE strCountry = ?",
"COLLATE NOCASE"
))
self.cursor.execute(query, (country,))
try:
country_id = self.cursor.fetchone()[0]
except TypeError:
# Create a new entry
self.cursor.execute("select coalesce(max(idCountry),0) from country")
country_id = self.cursor.fetchone()[0] + 1
query = "INSERT INTO country(idCountry, strCountry) values(?, ?)"
self.cursor.execute(query, (country_id, country))
log.debug("Add country to media, processing: %s", country)
query = (
'''
INSERT OR REPLACE INTO countrylinkmovie(idCountry, idMovie)
VALUES (?, ?)
'''
)
self.cursor.execute(query, (country_id, kodi_id))
query = (
'''
INSERT OR REPLACE INTO country_link(country_id, media_id, media_type)
VALUES (?, ?, ?)
'''
)
self.cursor.execute(query, (country_id, kodi_id, "movie"))
def _add_country(self, country):

View file

@ -189,26 +189,6 @@ class KodiMusic(KodiItems):
return album_id
def update_album(self, *args):
query = ' '.join((
"UPDATE album",
"SET strArtists = ?, iYear = ?, strGenres = ?, strReview = ?, strImage = ?,",
"iRating = ?, lastScraped = ?, strReleaseType = ?",
"WHERE idAlbum = ?"
))
self.cursor.execute(query, (args))
def update_album_18(self, *args):
query = ' '.join((
"UPDATE album",
"SET strArtistsDisp = ?, iYear = ?, strGenres = ?, strReview = ?, strImage = ?,",
"iUserrating = ?, lastScraped = ?, strReleaseType = ?",
"WHERE idAlbum = ?"
))
self.cursor.execute(query, (args))
def update_album_17(self, *args):
query = ' '.join((
"UPDATE album",
@ -218,27 +198,6 @@ class KodiMusic(KodiItems):
))
self.cursor.execute(query, (args))
def update_album_15(self, *args):
query = ' '.join((
"UPDATE album",
"SET strArtists = ?, iYear = ?, strGenres = ?, strReview = ?, strImage = ?,",
"iRating = ?, lastScraped = ?, dateAdded = ?, strReleaseType = ?",
"WHERE idAlbum = ?"
))
self.cursor.execute(query, (args))
def update_album_14(self, *args):
# TODO: Remove Helix code when Krypton is RC
query = ' '.join((
"UPDATE album",
"SET strArtists = ?, iYear = ?, strGenres = ?, strReview = ?, strImage = ?,",
"iRating = ?, lastScraped = ?, dateAdded = ?",
"WHERE idAlbum = ?"
))
self.cursor.execute(query, (args))
def get_album_artist(self, album_id, artists):
query = ' '.join((
@ -356,8 +315,8 @@ class KodiMusic(KodiItems):
"UPDATE song",
"SET idAlbum = ?, strArtistDisp = ?, strGenres = ?, strTitle = ?, iTrack = ?,",
"iDuration = ?, iYear = ?, strFilename = ?, iTimesPlayed = ?, lastplayed = ?,",
"rating = ?, comment = ?",
"iDuration = ?, iYear = ?, strFilename = ?, iTimesPlayed = ?, lastplayed = ?,",
"rating = ?, comment = ?",
"WHERE idSong = ?"
))
self.cursor.execute(query, (args))

View file

@ -174,9 +174,8 @@ class KodiTVShows(KodiItems):
except TypeError:
season_id = self._add_season(show_id, number)
if self.kodi_version > 15 and name is not None:
query = "UPDATE seasons SET name = ? WHERE idSeason = ?"
self.cursor.execute(query, (name, season_id))
query = "UPDATE seasons SET name = ? WHERE idSeason = ?"
self.cursor.execute(query, (name, season_id))
return season_id
@ -189,18 +188,6 @@ class KodiTVShows(KodiItems):
return season_id
def add_episode(self, *args):
query = (
'''
INSERT INTO episode(
idEpisode, idFile, c00, c01, c03, c04, c05, c09, c10, c12, c13, c14,
idShow, c15, c16)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
'''
)
self.cursor.execute(query, (args))
def add_episode_16(self, *args):
query = (
'''
INSERT INTO episode(
@ -213,16 +200,6 @@ class KodiTVShows(KodiItems):
self.cursor.execute(query, (args))
def update_episode(self, *args):
query = ' '.join((
"UPDATE episode",
"SET c00 = ?, c01 = ?, c03 = ?, c04 = ?, c05 = ?, c09 = ?, c10 = ?,",
"c12 = ?, c13 = ?, c14 = ?, c15 = ?, c16 = ?, idShow = ?",
"WHERE idEpisode = ?"
))
self.cursor.execute(query, (args))
def update_episode_16(self, *args):
query = ' '.join((
"UPDATE episode",

View file

@ -250,28 +250,18 @@ class Movies(Items):
if update_item:
log.info("UPDATE movie itemid: %s - Title: %s", itemid, title)
# update new ratings Kodi 17
if self.kodi_version >= 17:
ratingid = self.kodi_db.get_ratingid(movieid)
# update ratings
ratingid = self.kodi_db.get_ratingid(movieid)
self.kodi_db.update_ratings(movieid, "movie", "default", rating, votecount, ratingid)
self.kodi_db.update_ratings(movieid, "movie", "default", rating, votecount, ratingid)
# update new uniqueid Kodi 17
if self.kodi_version >= 17:
uniqueid = self.kodi_db.get_uniqueid(movieid)
self.kodi_db.update_uniqueid(movieid, "movie", imdb, "imdb", uniqueid)
# update uniqueid
uniqueid = self.kodi_db.get_uniqueid(movieid)
self.kodi_db.update_uniqueid(movieid, "movie", imdb, "imdb", uniqueid)
# Update the movie entry
if self.kodi_version >= 17:
self.kodi_db.update_movie_17(title, plot, shortplot, tagline, votecount, uniqueid,
writer, year, uniqueid, sorttitle, runtime, mpaa, genre,
director, title, studio, trailer, country, year,
movieid)
else:
self.kodi_db.update_movie(title, plot, shortplot, tagline, votecount, rating,
writer, year, imdb, sorttitle, runtime, mpaa, genre,
director, title, studio, trailer, country, movieid)
self.kodi_db.update_movie(title, plot, shortplot, tagline, votecount, uniqueid,
writer, year, uniqueid, sorttitle, runtime, mpaa, genre,
director, title, studio, trailer, country, year, movieid)
# Update the checksum in emby table
emby_db.updateReference(itemid, checksum)
@ -280,17 +270,13 @@ class Movies(Items):
else:
log.info("ADD movie itemid: %s - Title: %s", itemid, title)
# add new ratings Kodi 17
if self.kodi_version >= 17:
ratingid = self.kodi_db.create_entry_rating()
# Add ratings
ratingid = self.kodi_db.create_entry_rating()
self.kodi_db.add_ratings(ratingid, movieid, "movie", "default", rating, votecount)
self.kodi_db.add_ratings(ratingid, movieid, "movie", "default", rating, votecount)
# add new uniqueid Kodi 17
if self.kodi_version >= 17:
uniqueid = self.kodi_db.create_entry_uniqueid()
self.kodi_db.add_uniqueid(uniqueid, movieid, "movie", imdb, "imdb")
# Add uniqueid
uniqueid = self.kodi_db.create_entry_uniqueid()
self.kodi_db.add_uniqueid(uniqueid, movieid, "movie", imdb, "imdb")
# Add path
pathid = self.kodi_db.add_path(path)
@ -298,16 +284,10 @@ class Movies(Items):
fileid = self.kodi_db.add_file(filename, pathid)
# Create the movie entry
if self.kodi_version >= 17:
self.kodi_db.add_movie_17(movieid, fileid, title, plot, shortplot, tagline,
votecount, uniqueid, writer, year, uniqueid, sorttitle,
runtime, mpaa, genre, director, title, studio, trailer,
country, year)
else:
self.kodi_db.add_movie(movieid, fileid, title, plot, shortplot, tagline,
votecount, rating, writer, year, imdb, sorttitle,
runtime, mpaa, genre, director, title, studio, trailer,
country)
self.kodi_db.add_movie(movieid, fileid, title, plot, shortplot, tagline,
votecount, uniqueid, writer, year, uniqueid, sorttitle,
runtime, mpaa, genre, director, title, studio, trailer,
country, year)
# Create the reference in emby table
emby_db.addReference(itemid, movieid, "Movie", "movie", fileid, pathid, None,

View file

@ -303,22 +303,8 @@ class Music(Items):
emby_db.addReference(itemid, albumid, "MusicAlbum", "album", checksum=checksum)
# Process the album info
if self.kodi_version in [17,18]:
# Kodi Krypton/Leia
self.kodi_db.update_album_17(artistname, year, genre, bio, thumb, rating, lastScraped,
"album", albumid)
elif self.kodi_version == 16:
# Kodi Jarvis
self.kodi_db.update_album(artistname, year, genre, bio, thumb, rating, lastScraped,
"album", albumid)
elif self.kodi_version == 15:
# Kodi Isengard
self.kodi_db.update_album_15(artistname, year, genre, bio, thumb, rating, lastScraped,
dateadded, "album", albumid)
else:
# TODO: Remove Helix code when Krypton is RC
self.kodi_db.update_album_14(artistname, year, genre, bio, thumb, rating, lastScraped,
dateadded, albumid)
self.kodi_db.update_album(artistname, year, genre, bio, thumb, rating, lastScraped,
"album", albumid)
# Assign main artists to album
for artist in item['AlbumArtists']:

View file

@ -9,7 +9,7 @@ import api
import embydb_functions as embydb
import _kodi_tvshows
from _common import Items, catch_except
from utils import window, settings, language as lang, plugin_path
from utils import window, settings, language as lang, urllib_path
##################################################################################################
@ -234,11 +234,11 @@ class TVShows(Items):
artwork = self.artwork
API = api.API(item)
# Server api changed or something? RecursiveItemCount always returns 0
"""if settings('syncEmptyShows') == "false" and not item.get('RecursiveItemCount'):
if item.get('Name', None) is not None:
log.info("Skipping empty show: %s", item['Name'])
return"""
# If the show is empty, try to remove it.
if settings('syncEmptyShows') == "false" and not item.get('RecursiveItemCount'):
log.info("Skipping empty show: %s", item.get('Name', item['Id']))
return self.remove(item['Id'])
# If the item already exist in the local Kodi DB we'll perform a full item update
# If the item doesn't exist, we'll add it to the database
update_item = True
@ -308,12 +308,8 @@ class TVShows(Items):
if self.emby_db.get_view_grouped_series(viewid) and tvdb:
# search kodi db for same provider id
if self.kodi_version > 16:
query = "SELECT idShow FROM tvshow_view WHERE uniqueid_value = ?"
kodicursor.execute(query, (tvdb,))
else:
query = "SELECT idShow FROM tvshow WHERE C12 = ?"
kodicursor.execute(query, (tvdb,))
query = "SELECT idShow FROM tvshow_view WHERE uniqueid_value = ?"
kodicursor.execute(query, (tvdb,))
try:
temps_showid = kodicursor.fetchall()
@ -342,51 +338,22 @@ class TVShows(Items):
force_episodes = True
# Verify series pooling
"""if not update_item and tvdb:
query = "SELECT idShow FROM tvshow WHERE C12 = ?"
kodicursor.execute(query, (tvdb,))
try:
temp_showid = kodicursor.fetchone()[0]
except TypeError:
pass
else:
emby_other = emby_db.getItem_byKodiId(temp_showid, "tvshow")
if emby_other and viewid == emby_other[2]:
log.info("Applying series pooling for %s", title)
emby_other_item = emby_db.getItem_byId(emby_other[0])
showid = emby_other_item[0]
pathid = emby_other_item[2]
log.info("showid: %s pathid: %s", showid, pathid)
# Create the reference in emby table
emby_db.addReference(itemid, showid, "Series", "tvshow", pathid=pathid,
checksum=checksum, mediafolderid=viewid)
update_item = True"""
##### UPDATE THE TVSHOW #####
if update_item:
log.info("UPDATE tvshow itemid: %s - Title: %s", itemid, title)
# update new ratings Kodi 17
if self.kodi_version > 16:
ratingid = self.kodi_db.get_ratingid("tvshow", showid)
# update ratings
ratingid = self.kodi_db.get_ratingid("tvshow", showid)
self.kodi_db.update_ratings(showid, "tvshow", "default", rating, votecount,ratingid)
self.kodi_db.update_ratings(showid, "tvshow", "default", rating, votecount,ratingid)
# update new uniqueid Kodi 17
if self.kodi_version > 16:
uniqueid = self.kodi_db.get_uniqueid("tvshow", showid)
self.kodi_db.update_uniqueid(showid, "tvshow", tvdb, "unknown", uniqueid)
# update uniqueid
uniqueid = self.kodi_db.get_uniqueid("tvshow", showid)
self.kodi_db.update_uniqueid(showid, "tvshow", tvdb, "unknown", uniqueid)
# Update the tvshow entry
if self.kodi_version > 16:
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)
self.kodi_db.update_tvshow(title, plot, uniqueid, premieredate, genre, title,
uniqueid, mpaa, studio, sorttitle, showid)
# Update the checksum in emby table
emby_db.updateReference(itemid, checksum)
@ -394,17 +361,13 @@ class TVShows(Items):
else:
log.info("ADD tvshow itemid: %s - Title: %s", itemid, title)
# add new ratings Kodi 17
if self.kodi_version > 16:
ratingid = self.kodi_db.create_entry_rating()
# add ratings
ratingid = self.kodi_db.create_entry_rating()
self.kodi_db.add_ratings(ratingid, showid, "tvshow", "default", rating, votecount)
self.kodi_db.add_ratings(ratingid, showid, "tvshow", "default", rating, votecount)
# add new uniqueid Kodi 17
if self.kodi_version > 16:
uniqueid = self.kodi_db.create_entry_uniqueid()
self.kodi_db.add_uniqueid(uniqueid, showid, "tvshow", tvdb, "unknown")
# add uniqueid
uniqueid = self.kodi_db.create_entry_uniqueid()
self.kodi_db.add_uniqueid(uniqueid, showid, "tvshow", tvdb, "unknown")
# Add top path
toppathid = self.kodi_db.add_path(toplevelpath)
@ -414,12 +377,8 @@ class TVShows(Items):
pathid = self.kodi_db.add_path(path)
# Create the tvshow entry
if self.kodi_version > 16:
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)
self.kodi_db.add_tvshow(showid, title, plot, uniqueid, premieredate, genre,
title, uniqueid, mpaa, studio, sorttitle)
# Create the reference in emby table
emby_db.addReference(itemid, showid, "Series", "tvshow", pathid=pathid,
@ -629,39 +588,24 @@ class TVShows(Items):
'dbid': episodeid,
'mode': "play"
}
filename = plugin_path(path, params)
filename = urllib_path(path, params)
##### UPDATE THE EPISODE #####
if update_item:
log.info("UPDATE episode itemid: %s - Title: %s", itemid, title)
# update new ratings Kodi 17
if self.kodi_version >= 17:
ratingid = self.kodi_db.get_ratingid("episode", episodeid)
# update ratings
ratingid = self.kodi_db.get_ratingid("episode", episodeid)
self.kodi_db.update_ratings(episodeid, "episode", "default", rating, votecount, ratingid)
self.kodi_db.update_ratings(episodeid, "episode", "default", rating, votecount,ratingid)
# update new uniqueid Kodi 17
if self.kodi_version >= 17:
uniqueid = self.kodi_db.get_uniqueid("episode", episodeid)
self.kodi_db.update_uniqueid(episodeid, "episode", tvdb, "tvdb",uniqueid)
# update uniqueid
uniqueid = self.kodi_db.get_uniqueid("episode", episodeid)
self.kodi_db.update_uniqueid(episodeid, "episode", tvdb, "tvdb", uniqueid)
# Update the episode entry
if self.kodi_version >= 17:
# 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 >= 16 and self.kodi_version < 17:
# Kodi Jarvis
self.kodi_db.update_episode_16(title, plot, rating, writer, premieredate, runtime,
director, season, episode, title, airsBeforeSeason,
airsBeforeEpisode, seasonid, showid, episodeid)
else:
self.kodi_db.update_episode(title, plot, rating, writer, premieredate, runtime,
director, season, episode, title, airsBeforeSeason,
airsBeforeEpisode, showid, episodeid)
self.kodi_db.update_episode(title, plot, uniqueid, writer, premieredate, runtime,
director, season, episode, title, airsBeforeSeason,
airsBeforeEpisode, seasonid, showid, episodeid)
# Update the checksum in emby table
emby_db.updateReference(itemid, checksum)
@ -672,17 +616,13 @@ class TVShows(Items):
else:
log.info("ADD episode itemid: %s - Title: %s", itemid, title)
# add new ratings Kodi 17
if self.kodi_version >= 17:
ratingid = self.kodi_db.create_entry_rating()
# add ratings
ratingid = self.kodi_db.create_entry_rating()
self.kodi_db.add_ratings(ratingid, episodeid, "episode", "default", rating, votecount)
self.kodi_db.add_ratings(ratingid, episodeid, "episode", "default", rating, votecount)
# add new uniqueid Kodi 17
if self.kodi_version >= 17:
uniqueid = self.kodi_db.create_entry_uniqueid()
self.kodi_db.add_uniqueid(uniqueid, episodeid, "episode", tvdb, "tvdb")
# add uniqueid
uniqueid = self.kodi_db.create_entry_uniqueid()
self.kodi_db.add_uniqueid(uniqueid, episodeid, "episode", tvdb, "tvdb")
# Add path
pathid = self.kodi_db.add_path(path)
@ -690,20 +630,9 @@ class TVShows(Items):
fileid = self.kodi_db.add_file(filename, pathid)
# Create the episode entry
if self.kodi_version >= 17:
# 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 >= 16 and self.kodi_version < 17:
# Kodi Jarvis
self.kodi_db.add_episode_16(episodeid, fileid, title, plot, rating, writer,
premieredate, runtime, director, season, episode, title,
showid, airsBeforeSeason, airsBeforeEpisode, seasonid)
else:
self.kodi_db.add_episode(episodeid, fileid, title, plot, rating, writer,
premieredate, runtime, director, season, episode, title,
showid, airsBeforeSeason, airsBeforeEpisode)
self.kodi_db.add_episode(episodeid, fileid, title, plot, uniqueid, writer,
premieredate, runtime, director, season, episode, title,
showid, airsBeforeSeason, airsBeforeEpisode, seasonid)
# Create the reference in emby table
emby_db.addReference(itemid, episodeid, "Episode", "episode", fileid, pathid,