From bcc8b05517d6eab0f52da7be27d437ccfe2e1b9a Mon Sep 17 00:00:00 2001 From: "Nicholas St. Germain" Date: Thu, 18 Apr 2019 21:28:23 -0500 Subject: [PATCH] change iteration to only drop the bad shows. Will get more specific after we get a data dump of a bad example --- varken/sonarr.py | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/varken/sonarr.py b/varken/sonarr.py index 0e010f4..eea265f 100644 --- a/varken/sonarr.py +++ b/varken/sonarr.py @@ -90,10 +90,14 @@ class SonarrAPI(object): if not get: return - try: - tv_shows = [SonarrTVShow(**show) for show in get] - except TypeError as e: - self.logger.error('TypeError has occurred : %s while creating SonarrTVShow structure', e) + tv_shows = [] + for show in get: + try: + show_tuple = SonarrTVShow(**show) + tv_shows.append(show_tuple) + except TypeError as e: + self.logger.error('TypeError has occurred : %s while creating SonarrTVShow structure for show', e) + if not tv_shows: return for show in tv_shows: @@ -140,10 +144,14 @@ class SonarrAPI(object): if not get: return - try: - download_queue = [Queue(**show) for show in get] - except TypeError as e: - self.logger.error('TypeError has occurred : %s while creating Queue structure', e) + download_queue = [] + for show in get: + try: + show_tuple = Queue(**show) + download_queue.append(show_tuple) + except TypeError as e: + self.logger.error('TypeError has occurred : %s while creating Queue structure', e) + if not download_queue: return for show in download_queue: