Fix episode filename & path not being updated
This commit is contained in:
parent
c35ba0edef
commit
14d279aa4c
1 changed files with 24 additions and 22 deletions
|
@ -961,6 +961,11 @@ class TVShows(Items):
|
||||||
# c19 - pathid
|
# c19 - pathid
|
||||||
# This information is used later by file browser.
|
# This information is used later by file browser.
|
||||||
|
|
||||||
|
# add/retrieve pathid and fileid
|
||||||
|
# if the path or file already exists, the calls return current value
|
||||||
|
pathid = self.kodi_db.addPath(path)
|
||||||
|
fileid = self.kodi_db.addFile(filename, pathid)
|
||||||
|
|
||||||
# UPDATE THE EPISODE #####
|
# UPDATE THE EPISODE #####
|
||||||
if update_item:
|
if update_item:
|
||||||
log.info("UPDATE episode itemid: %s" % (itemid))
|
log.info("UPDATE episode itemid: %s" % (itemid))
|
||||||
|
@ -969,40 +974,35 @@ class TVShows(Items):
|
||||||
if self.kodiversion in (16, 17):
|
if self.kodiversion in (16, 17):
|
||||||
# Kodi Jarvis, Krypton
|
# Kodi Jarvis, Krypton
|
||||||
query = ' '.join((
|
query = ' '.join((
|
||||||
|
|
||||||
"UPDATE episode",
|
"UPDATE episode",
|
||||||
"SET c00 = ?, c01 = ?, c03 = ?, c04 = ?, c05 = ?, c09 = ?, c10 = ?,",
|
"SET c00 = ?, c01 = ?, c03 = ?, c04 = ?, c05 = ?, c09 = ?,"
|
||||||
"c12 = ?, c13 = ?, c14 = ?, c15 = ?, c16 = ?, c18 = ?, c19 = ?,",
|
"c10 = ?, c12 = ?, c13 = ?, c14 = ?, c15 = ?, c16 = ?,"
|
||||||
"idSeason = ?",
|
"c18 = ?, c19 = ?, idFile=?, idSeason = ?",
|
||||||
"WHERE idEpisode = ?"
|
"WHERE idEpisode = ?"
|
||||||
))
|
))
|
||||||
kodicursor.execute(query, (title, plot, rating, writer, premieredate,
|
kodicursor.execute(query, (title, plot, rating, writer,
|
||||||
runtime, director, season, episode, title, airsBeforeSeason,
|
premieredate, runtime, director, season, episode, title,
|
||||||
airsBeforeEpisode, playurl, pathid, seasonid, episodeid))
|
airsBeforeSeason, airsBeforeEpisode, playurl, pathid,
|
||||||
|
fileid, seasonid, episodeid))
|
||||||
else:
|
else:
|
||||||
query = ' '.join((
|
query = ' '.join((
|
||||||
|
|
||||||
"UPDATE episode",
|
"UPDATE episode",
|
||||||
"SET c00 = ?, c01 = ?, c03 = ?, c04 = ?, c05 = ?, c09 = ?, c10 = ?,",
|
"SET c00 = ?, c01 = ?, c03 = ?, c04 = ?, c05 = ?, c09 = ?,"
|
||||||
"c12 = ?, c13 = ?, c14 = ?, c15 = ?, c16 = ?, c18 = ?, c19 = ?",
|
"c10 = ?, c12 = ?, c13 = ?, c14 = ?, c15 = ?, c16 = ?,"
|
||||||
|
"c18 = ?, c19 = ?, idFile = ?",
|
||||||
"WHERE idEpisode = ?"
|
"WHERE idEpisode = ?"
|
||||||
))
|
))
|
||||||
kodicursor.execute(query, (title, plot, rating, writer, premieredate,
|
kodicursor.execute(query, (title, plot, rating, writer,
|
||||||
runtime, director, season, episode, title, airsBeforeSeason,
|
premieredate, runtime, director, season, episode, title,
|
||||||
airsBeforeEpisode, playurl, pathid, episodeid))
|
airsBeforeSeason, airsBeforeEpisode, playurl, pathid,
|
||||||
|
fileid, episodeid))
|
||||||
# Update the checksum in emby table
|
|
||||||
emby_db.updateReference(itemid, checksum)
|
|
||||||
# Update parentid reference
|
# Update parentid reference
|
||||||
emby_db.updateParentId(itemid, seasonid)
|
emby_db.updateParentId(itemid, seasonid)
|
||||||
|
|
||||||
##### OR ADD THE EPISODE #####
|
##### OR ADD THE EPISODE #####
|
||||||
else:
|
else:
|
||||||
log.info("ADD episode itemid: %s - Title: %s" % (itemid, title))
|
log.info("ADD episode itemid: %s - Title: %s" % (itemid, title))
|
||||||
# Add path
|
|
||||||
pathid = self.kodi_db.addPath(path)
|
|
||||||
# Add the file
|
|
||||||
fileid = self.kodi_db.addFile(filename, pathid)
|
|
||||||
# Create the episode entry
|
# Create the episode entry
|
||||||
if self.kodiversion in (16, 17):
|
if self.kodiversion in (16, 17):
|
||||||
# Kodi Jarvis, Krypton
|
# Kodi Jarvis, Krypton
|
||||||
|
@ -1032,9 +1032,11 @@ class TVShows(Items):
|
||||||
premieredate, runtime, director, season, episode, title, showid,
|
premieredate, runtime, director, season, episode, title, showid,
|
||||||
airsBeforeSeason, airsBeforeEpisode, playurl, pathid))
|
airsBeforeSeason, airsBeforeEpisode, playurl, pathid))
|
||||||
|
|
||||||
# Create the reference in emby table
|
# Create or update the reference in emby table Add reference is
|
||||||
emby_db.addReference(itemid, episodeid, "Episode", "episode", fileid, pathid,
|
# idempotent; the call here updates also fileid and pathid when item is
|
||||||
seasonid, checksum)
|
# moved or renamed
|
||||||
|
emby_db.addReference(itemid, episodeid, "Episode", "episode", fileid,
|
||||||
|
pathid, seasonid, checksum)
|
||||||
|
|
||||||
# Update the path
|
# Update the path
|
||||||
query = ' '.join((
|
query = ' '.join((
|
||||||
|
|
Loading…
Reference in a new issue