Skip to content

Commit

Permalink
[patch] Added exception handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Feramance committed Oct 16, 2024
1 parent b132e74 commit 3a3f4f1
Showing 1 changed file with 78 additions and 54 deletions.
132 changes: 78 additions & 54 deletions qBitrr/arss.py
Original file line number Diff line number Diff line change
Expand Up @@ -2245,25 +2245,34 @@ def db_update_single_series(
).execute()

if self.use_temp_for_missing:
if (
searched
and db_entry["qualityProfileId"] == self.temp_quality_profile_id
):
data: JsonObject = {"qualityProfileId": self.main_quality_profile_id}
self.logger.debug(
"Updating quality profile for %s to %s",
db_entry["title"],
self.temp_quality_profile,
)
elif (
not searched
and db_entry["qualityProfileId"] == self.main_quality_profile_id
):
data: JsonObject = {"qualityProfileId": self.temp_quality_profile_id}
self.logger.debug(
"Updating quality profile for %s to %s",
db_entry["title"],
self.temp_quality_profile,
try:
if (
searched
and db_entry["qualityProfileId"] == self.temp_quality_profile_id
):
data: JsonObject = {
"qualityProfileId": self.main_quality_profile_id
}
self.logger.debug(
"Updating quality profile for %s to %s",
db_entry["title"],
self.temp_quality_profile,
)
elif (
not searched
and db_entry["qualityProfileId"] == self.main_quality_profile_id
):
data: JsonObject = {
"qualityProfileId": self.temp_quality_profile_id
}
self.logger.debug(
"Updating quality profile for %s to %s",
db_entry["title"],
self.temp_quality_profile,
)
except KeyError:
self.logger.warning(
"Check quality profile settings for %s", db_entry["title"]
)
while True:
try:
Expand Down Expand Up @@ -2439,25 +2448,32 @@ def db_update_single_series(
else:
searched = (episodeCount + monitoredEpisodeCount) == episodeFileCount
if self.use_temp_for_missing:
if (
searched
and db_entry["qualityProfileId"] == self.temp_quality_profile_id
):
db_entry["qualityProfileId"] = self.main_quality_profile_id
self.logger.debug(
"Updating quality profile for %s to %s",
db_entry["title"],
self.temp_quality_profile,
)
elif (
not searched
and db_entry["qualityProfileId"] == self.main_quality_profile_id
):
db_entry["qualityProfileId"] = self.temp_quality_profile_id
self.logger.debug(
"Updating quality profile for %s to %s",
db_entry["title"],
self.temp_quality_profile,
try:
if (
searched
and db_entry["qualityProfileId"]
== self.temp_quality_profile_id
):
db_entry["qualityProfileId"] = self.main_quality_profile_id
self.logger.debug(
"Updating quality profile for %s to %s",
db_entry["title"],
self.temp_quality_profile,
)
elif (
not searched
and db_entry["qualityProfileId"]
== self.main_quality_profile_id
):
db_entry["qualityProfileId"] = self.temp_quality_profile_id
self.logger.debug(
"Updating quality profile for %s to %s",
db_entry["title"],
self.temp_quality_profile,
)
except KeyError:
self.logger.warning(
"Check quality profile settings for %s", db_entry["title"]
)
while True:
try:
Expand Down Expand Up @@ -2574,22 +2590,30 @@ def db_update_single_series(
).execute()

if self.use_temp_for_missing:
if searched and db_entry["qualityProfileId"] == self.temp_quality_profile_id:
db_entry["qualityProfileId"] = self.main_quality_profile_id
self.logger.debug(
"Updating quality profile for %s to %s",
db_entry["title"],
self.temp_quality_profile,
)
elif (
not searched
and db_entry["qualityProfileId"] == self.main_quality_profile_id
):
db_entry["qualityProfileId"] = self.temp_quality_profile_id
self.logger.debug(
"Updating quality profile for %s to %s",
db_entry["title"],
self.temp_quality_profile,
try:
if (
searched
and db_entry["qualityProfileId"] == self.temp_quality_profile_id
):
db_entry["qualityProfileId"] = self.main_quality_profile_id
self.logger.debug(
"Updating quality profile for %s to %s",
db_entry["title"],
self.temp_quality_profile,
)
elif (
not searched
and db_entry["qualityProfileId"] == self.main_quality_profile_id
):
db_entry["qualityProfileId"] = self.temp_quality_profile_id
self.logger.debug(
"Updating quality profile for %s to %s",
db_entry["title"],
self.temp_quality_profile,
)
except KeyError:
self.logger.warning(
"Check quality profile settings for %s", db_entry["title"]
)
while True:
try:
Expand Down

0 comments on commit 3a3f4f1

Please sign in to comment.