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
  • Loading branch information
Dinnerbone authored and MDHMatt committed May 12, 2023
1 parent 3c78252 commit 9efa904
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 9efa904

Please sign in to comment.