Skip to content

Commit

Permalink
Error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Feramance committed May 29, 2024
1 parent a831abd commit 2543508
Showing 1 changed file with 49 additions and 4 deletions.
53 changes: 49 additions & 4 deletions qBitrr/arss.py
Original file line number Diff line number Diff line change
Expand Up @@ -2172,7 +2172,18 @@ def db_update_single_series(
self.logger.debug(
"Updating quality profile to %s", self.temp_quality_profile
)
self.client.upd_episode(episode["id"], data)
completed = True
while completed:
completed = False
try:
self.client.upd_episode(episode["id"], data)
except (
requests.exceptions.ChunkedEncodingError,
requests.exceptions.ContentDecodingError,
requests.exceptions.ConnectionError,
JSONDecodeError,
) as e:
completed = True

if episode["monitored"] == True:
EntryId = episode["id"]
Expand Down Expand Up @@ -2355,7 +2366,19 @@ def db_update_single_series(
self.logger.debug(
"Updating quality profile to %s", self.temp_quality_profile
)
self.client.upd_series(db_entry)
completed = True
while completed:
completed = False
try:
self.client.upd_series(db_entry)
except (
requests.exceptions.ChunkedEncodingError,
requests.exceptions.ContentDecodingError,
requests.exceptions.ConnectionError,
JSONDecodeError,
) as e:
completed = True

Title = seriesMetadata.get("title")
Monitored = db_entry["monitored"]

Expand Down Expand Up @@ -2473,7 +2496,18 @@ def db_update_single_series(
self.logger.debug(
"Updating quality profile to %s", self.temp_quality_profile
)
self.client.upd_movie(db_entry)
completed = True
while completed:
completed = False
try:
self.client.upd_movie(db_entry)
except (
requests.exceptions.ChunkedEncodingError,
requests.exceptions.ContentDecodingError,
requests.exceptions.ConnectionError,
JSONDecodeError,
) as e:
completed = True

if self.minimum_availability_check(db_entry) and db_entry["monitored"] == True:
title = db_entry["title"]
Expand Down Expand Up @@ -4303,7 +4337,18 @@ def _update_bad_queue_items(self):
def parse_quality_profiles(self) -> tuple[int, int]:
main_quality_profile_id = 0
temp_quality_profile_id = 0
profiles = self.client.get_quality_profile()
completed = True
while completed:
completed = False
try:
profiles = self.client.get_quality_profile()
except (
requests.exceptions.ChunkedEncodingError,
requests.exceptions.ContentDecodingError,
requests.exceptions.ConnectionError,
JSONDecodeError,
) as e:
completed = True
for p in profiles:
if p["name"] == self.main_quality_profile:
main_quality_profile_id = p["id"]
Expand Down

0 comments on commit 2543508

Please sign in to comment.