update sonarr error logging

This commit is contained in:
Nicholas St. Germain 2019-04-19 12:48:04 -05:00
parent ed07d69cdc
commit 23fa435590

View file

@ -38,12 +38,10 @@ class SonarrAPI(object):
tv_shows = [] tv_shows = []
for show in get: for show in get:
try: try:
show_tuple = SonarrTVShow(**show) tv_shows.append(SonarrTVShow(**show))
tv_shows.append(show_tuple)
except TypeError as e: except TypeError as e:
self.logger.error('TypeError has occurred : %s while creating SonarrTVShow structure for show', e) self.logger.error('TypeError has occurred : %s while creating SonarrTVShow structure for show. Data '
if not tv_shows: 'attempted is: %s', e, show)
return
# Add show to missing list if file does not exist # Add show to missing list if file does not exist
for show in tv_shows: for show in tv_shows:
@ -93,12 +91,10 @@ class SonarrAPI(object):
tv_shows = [] tv_shows = []
for show in get: for show in get:
try: try:
show_tuple = SonarrTVShow(**show) tv_shows.append(SonarrTVShow(**show))
tv_shows.append(show_tuple)
except TypeError as e: except TypeError as e:
self.logger.error('TypeError has occurred : %s while creating SonarrTVShow structure for show', e) self.logger.error('TypeError has occurred : %s while creating SonarrTVShow structure for show. Data '
if not tv_shows: 'attempted is: %s', e, show)
return
for show in tv_shows: for show in tv_shows:
sxe = f'S{show.seasonNumber:0>2}E{show.episodeNumber:0>2}' sxe = f'S{show.seasonNumber:0>2}E{show.episodeNumber:0>2}'
@ -147,10 +143,10 @@ class SonarrAPI(object):
download_queue = [] download_queue = []
for show in get: for show in get:
try: try:
show_tuple = Queue(**show) download_queue.append(Queue(**show))
download_queue.append(show_tuple)
except TypeError as e: except TypeError as e:
self.logger.error('TypeError has occurred : %s while creating Queue structure', e) self.logger.error('TypeError has occurred : %s while creating Queue structure. Data attempted is: '
'%s', e, show)
if not download_queue: if not download_queue:
return return
@ -159,7 +155,7 @@ class SonarrAPI(object):
sxe = f"S{show.episode['seasonNumber']:0>2}E{show.episode['episodeNumber']:0>2}" sxe = f"S{show.episode['seasonNumber']:0>2}E{show.episode['episodeNumber']:0>2}"
except TypeError as e: except TypeError as e:
self.logger.error('TypeError has occurred : %s while processing the sonarr queue. \ self.logger.error('TypeError has occurred : %s while processing the sonarr queue. \
Remove invalid queue entries.', e) Remove invalid queue entry. Data attempted is: %s', e, show)
continue continue
if show.protocol.upper() == 'USENET': if show.protocol.upper() == 'USENET':