Added except block for KeyError except block
MODIFY
main.py
main.py
@@ -186,6 +186,13 @@ def process_show_section(s):
for episode in show.episodes():
try:
eps = lookup[episode.seasonNumber][episode.index]
+ except KeyError:
+ try:
+ logging.warning("Show [{} ({})]: Key not found, did not record episode S{:02}E{:02}".format(
+ show.title, show.year, episode.seasonNumber, episode.index))
+ except TypeError:
+ logging.error("Show [{} ({})]: Invalid episode {}".format(show.title, show.year, episode))
+ continue
watched = trakt_watched.get_completed(
episode.seasonNumber, episode.index)
collected = trakt_collected.get_completed(
@@ -224,9 +231,6 @@ def process_show_section(s):
episode.isWatched, watched, episode.isWatched != watched))
logging.debug("Show [{} ({})]: Synced episode S{:02}E{:02}".format(
show.title, show.year, episode.seasonNumber, episode.index))
- except KeyError:
- logging.warning("Show [{} ({})]: Key not found, did not record episode S{:02}E{:02}".format(
- show.title, show.year, episode.seasonNumber, episode.index))
logging.info("Show [{} ({})]: Finished sync".format(
show.title, show.year))
except trakt.errors.NotFoundException:

Added except block for KeyError except block