jarvis support

This commit is contained in:
im85288 2015-10-11 23:50:46 +01:00
parent f7fe85faae
commit 75a877ee9e
2 changed files with 17 additions and 7 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="1.1.46" version="1.1.47"
provider-name="Emby.media"> provider-name="Emby.media">
<requires> <requires>
<import addon="xbmc.python" version="2.1.0"/> <import addon="xbmc.python" version="2.1.0"/>

View file

@ -549,7 +549,7 @@ class WriteKodiVideoDB():
self.updateSeasons(embyId, showid, connection, cursor) self.updateSeasons(embyId, showid, connection, cursor)
def addOrUpdateEpisodeToKodiLibrary(self, embyId, showid, connection, cursor): def addOrUpdateEpisodeToKodiLibrary(self, embyId, showid, connection, cursor):
kodiVersion = self.kodiversion
MBitem = ReadEmbyDB().getFullItem(embyId) MBitem = ReadEmbyDB().getFullItem(embyId)
if not MBitem: if not MBitem:
@ -637,6 +637,8 @@ class WriteKodiVideoDB():
except: # Season does not exist, update seasons except: # Season does not exist, update seasons
self.updateSeasons(seriesId, showid, connection, cursor) self.updateSeasons(seriesId, showid, connection, cursor)
cursor.execute("SELECT idSeason FROM seasons WHERE idShow = ? and season = ?", (showid, season,))
idSeason = cursor.fetchone()[0]
##### UPDATE THE EPISODE ##### ##### UPDATE THE EPISODE #####
if episodeid: if episodeid:
@ -650,8 +652,12 @@ class WriteKodiVideoDB():
query = "UPDATE files SET strFilename = ? WHERE idFile = ?" query = "UPDATE files SET strFilename = ? WHERE idFile = ?"
cursor.execute(query, (filename, fileid)) cursor.execute(query, (filename, fileid))
query = "UPDATE episode SET c00 = ?, c01 = ?, c03 = ?, c04 = ?, c05 = ?, c09 = ?, c10 = ?, c12 = ?, c13 = ?, c14 = ?, c15 = ?, c16 = ? WHERE idEpisode = ?" if kodiVersion == 16:
cursor.execute(query, (title, plot, rating, writer, premieredate, runtime, director, season, episode, title, airsBeforeSeason, airsBeforeEpisode, episodeid)) query = "UPDATE episode SET c00 = ?, c01 = ?, c03 = ?, c04 = ?, c05 = ?, c09 = ?, c10 = ?, c12 = ?, c13 = ?, c14 = ?, c15 = ?, c16 = ?, idSeason = ? WHERE idEpisode = ?"
cursor.execute(query, (title, plot, rating, writer, premieredate, runtime, director, season, episode, title, airsBeforeSeason, airsBeforeEpisode, idSeason ,episodeid))
else:
query = "UPDATE episode SET c00 = ?, c01 = ?, c03 = ?, c04 = ?, c05 = ?, c09 = ?, c10 = ?, c12 = ?, c13 = ?, c14 = ?, c15 = ?, c16 = ? WHERE idEpisode = ?"
cursor.execute(query, (title, plot, rating, writer, premieredate, runtime, director, season, episode, title, airsBeforeSeason, airsBeforeEpisode, episodeid))
#update the checksum in emby table #update the checksum in emby table
query = "UPDATE emby SET checksum = ? WHERE emby_id = ?" query = "UPDATE emby SET checksum = ? WHERE emby_id = ?"
@ -689,8 +695,12 @@ class WriteKodiVideoDB():
# Create the episode # Create the episode
cursor.execute("select coalesce(max(idEpisode),0) as episodeid from episode") cursor.execute("select coalesce(max(idEpisode),0) as episodeid from episode")
episodeid = cursor.fetchone()[0] + 1 episodeid = cursor.fetchone()[0] + 1
query = "INSERT INTO episode(idEpisode, idFile, c00, c01, c03, c04, c05, c09, c10, c12, c13, c14, idShow, c15, c16) values(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)" if kodiVersion == 16:
cursor.execute(query, (episodeid, fileid, title, plot, rating, writer, premieredate, runtime, director, season, episode, title, showid, airsBeforeSeason, airsBeforeEpisode)) query = "INSERT INTO episode(idEpisode, idFile, c00, c01, c03, c04, c05, c09, c10, c12, c13, c14, idShow, c15, c16, idSeason) values(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"
cursor.execute(query, (episodeid, fileid, title, plot, rating, writer, premieredate, runtime, director, season, episode, title, showid, airsBeforeSeason, airsBeforeEpisode, idSeason))
else:
query = "INSERT INTO episode(idEpisode, idFile, c00, c01, c03, c04, c05, c09, c10, c12, c13, c14, idShow, c15, c16) values(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"
cursor.execute(query, (episodeid, fileid, title, plot, rating, writer, premieredate, runtime, director, season, episode, title, showid, airsBeforeSeason, airsBeforeEpisode))
# Create the reference in emby table # Create the reference in emby table
query = "INSERT INTO emby(emby_id, kodi_id, kodi_file_id, media_type, checksum, parent_id) values(?, ?, ?, ?, ?, ?)" query = "INSERT INTO emby(emby_id, kodi_id, kodi_file_id, media_type, checksum, parent_id) values(?, ?, ?, ?, ?, ?)"