Fix error caused by idSeason
Will properly skip the episode in the event the actual season is missing it's number.
This commit is contained in:
parent
48654801e5
commit
582949e79c
1 changed files with 15 additions and 9 deletions
|
@ -627,18 +627,24 @@ class WriteKodiVideoDB():
|
||||||
path = "plugin://plugin.video.emby/tvshows/%s/" % seriesId
|
path = "plugin://plugin.video.emby/tvshows/%s/" % seriesId
|
||||||
|
|
||||||
# Validate the season exists in Emby and in database
|
# Validate the season exists in Emby and in database
|
||||||
if season is None or season == 0:
|
if season is None:
|
||||||
self.logMsg("SKIP adding episode to Kodi Library, no season assigned - ID: %s - %s" % (embyId, title))
|
self.logMsg("SKIP adding episode to Kodi Library, no season assigned - ID: %s - %s" % (embyId, title))
|
||||||
return False
|
return False
|
||||||
|
|
||||||
cursor.execute("SELECT idSeason FROM seasons WHERE idShow = ? and season = ?", (showid, season,))
|
idSeason = None
|
||||||
try:
|
count = 0
|
||||||
cursor.fetchone()[0]
|
while idSeason is None:
|
||||||
except: # Season does not exist, update seasons
|
cursor.execute("SELECT idSeason FROM seasons WHERE idShow = ? and season = ?", (showid, season,))
|
||||||
self.updateSeasons(seriesId, showid, connection, cursor)
|
try:
|
||||||
|
idSeason = cursor.fetchone()[0]
|
||||||
cursor.execute("SELECT idSeason FROM seasons WHERE idShow = ? and season = ?", (showid, season,))
|
except: # Season does not exist, update seasons
|
||||||
idSeason = cursor.fetchone()[0]
|
if not count:
|
||||||
|
self.updateSeasons(seriesId, showid, connection, cursor)
|
||||||
|
count += 1
|
||||||
|
else:
|
||||||
|
# Season is still not found, skip episode.
|
||||||
|
self.logMsg("Skipping episode: %s. Season number is missing at season level in the metadata manager." % title, 1)
|
||||||
|
return False
|
||||||
|
|
||||||
##### UPDATE THE EPISODE #####
|
##### UPDATE THE EPISODE #####
|
||||||
if episodeid:
|
if episodeid:
|
||||||
|
|
Loading…
Reference in a new issue