Skip to content

Commit

Permalink
fix(sonarr): ensure invalid sonarr queue items are just skipped over -
Browse files Browse the repository at this point in the history
…fixes #239 (#243)
  • Loading branch information
Dinnerbone authored Jul 18, 2022
1 parent a197cb6 commit b077508
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions varken/sonarr.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ def get_queue(self):
endpoint = '/api/v3/queue'
now = datetime.now(timezone.utc).astimezone().isoformat()
pageSize = 250
params = {'pageSize': pageSize, 'includeSeries': True, 'includeEpisode': True}
params = {'pageSize': pageSize, 'includeSeries': True, 'includeEpisode': True,
'includeUnknownSeriesItems': False}
queueResponse = []
queue = []

Expand All @@ -119,7 +120,8 @@ def get_queue(self):

while response.totalRecords > response.page * response.pageSize:
page = response.page + 1
params = {'pageSize': pageSize, 'page': page, 'includeSeries': True, 'includeEpisode': True}
params = {'pageSize': pageSize, 'page': page, 'includeSeries': True, 'includeEpisode': True,
'includeUnknownSeriesItems': False}
req = self.session.prepare_request(Request('GET', self.server.url + endpoint, params=params))
get = connection_handler(self.session, req, self.server.verify_ssl)
if not get:
Expand All @@ -140,8 +142,8 @@ def get_queue(self):

for queueItem in download_queue:
tvShow = SonarrTVShow(**queueItem.series)
episode = SonarrEpisode(**queueItem.episode)
try:
episode = SonarrEpisode(**queueItem.episode)
sxe = f"S{episode.seasonNumber:0>2}E{episode.episodeNumber:0>2}"
except TypeError as e:
self.logger.error('TypeError has occurred : %s while processing the sonarr queue. \
Expand Down

0 comments on commit b077508

Please sign in to comment.