Private GIT

Skip to content
Snippets Groups Projects
Commit 984ea92d authored by Nic Wolfe's avatar Nic Wolfe
Browse files

Fix shows that were "stuck" and wouldn't update because of deleted seasons on...

Fix shows that were "stuck" and wouldn't update because of deleted seasons on TVDB (Parks & Rec, It's Always Sunny, Futurama, etc etc)
parent f4255a7f
Branches
Tags
No related merge requests found
...@@ -228,13 +228,18 @@ class TVShow(object): ...@@ -228,13 +228,18 @@ class TVShow(object):
cachedShow = t[self.tvdbid] cachedShow = t[self.tvdbid]
cachedSeasons = {} cachedSeasons = {}
deleteEp = False
for curResult in sqlResults: for curResult in sqlResults:
curSeason = int(curResult["season"]) curSeason = int(curResult["season"])
curEpisode = int(curResult["episode"]) curEpisode = int(curResult["episode"])
if curSeason not in cachedSeasons: if curSeason not in cachedSeasons:
try:
cachedSeasons[curSeason] = cachedShow[curSeason] cachedSeasons[curSeason] = cachedShow[curSeason]
except tvdb_exceptions.tvdb_seasonnotfound, e:
logger.log(u"Error when trying to load the episode from TVDB: "+e.message, logger.WARNING)
deleteEp = True
if not curSeason in scannedEps: if not curSeason in scannedEps:
scannedEps[curSeason] = {} scannedEps[curSeason] = {}
...@@ -243,6 +248,11 @@ class TVShow(object): ...@@ -243,6 +248,11 @@ class TVShow(object):
try: try:
curEp = self.getEpisode(curSeason, curEpisode) curEp = self.getEpisode(curSeason, curEpisode)
# if we found out that the ep is no longer on TVDB then delete it from our database too
if deleteEp:
curEp.deleteEpisode()
curEp.loadFromDB(curSeason, curEpisode) curEp.loadFromDB(curSeason, curEpisode)
curEp.loadFromTVDB(tvapi=t, cachedSeason=cachedSeasons[curSeason]) curEp.loadFromTVDB(tvapi=t, cachedSeason=cachedSeasons[curSeason])
scannedEps[curSeason][curEpisode] = True scannedEps[curSeason][curEpisode] = True
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment