Skip to content

Commit

Permalink
Adjusted request conditions further
Browse files Browse the repository at this point in the history
  • Loading branch information
Feramance committed Dec 6, 2024
1 parent beb7169 commit d69afa4
Showing 1 changed file with 7 additions and 51 deletions.
58 changes: 7 additions & 51 deletions qBitrr/arss.py
Original file line number Diff line number Diff line change
Expand Up @@ -1623,32 +1623,9 @@ def db_get_request_files(self) -> Iterable[tuple[MoviesFilesModel | EpisodeFiles
self.logger.trace("Getting request files")
if self.type == "sonarr":
condition = self.model_file.IsRequest == True
condition = self.model_file.AirDateUtc.is_null(False)
if not self.search_specials:
condition &= self.model_file.SeasonNumber != 0
if self.do_upgrade_search:
condition &= self.model_file.Upgrade == False
else:
if self.quality_unmet_search and not self.custom_format_unmet_search:
condition &= (
self.model_file.Searched == False | self.model_file.QualityMet == False
)
elif not self.quality_unmet_search and self.custom_format_unmet_search:
condition &= (
self.model_file.Searched
== False | self.model_file.CustomFormatMet
== False
)
elif self.quality_unmet_search and self.custom_format_unmet_search:
condition &= (
self.model_file.Searched
== False | self.model_file.QualityMet
== False | self.model_file.CustomFormatMet
== False
)
else:
condition &= self.model_file.EpisodeFileId == 0
condition &= self.model_file.Searched == False
condition &= self.model_file.AirDateUtc.is_null(False)
condition &= self.model_file.EpisodeFileId == 0
condition &= self.model_file.Searched == False
condition &= self.model_file.AirDateUtc < (
datetime.now(timezone.utc) - timedelta(days=1)
)
Expand All @@ -1664,30 +1641,9 @@ def db_get_request_files(self) -> Iterable[tuple[MoviesFilesModel | EpisodeFiles
)
elif self.type == "radarr":
condition = self.model_file.IsRequest == True
condition = self.model_file.Year.is_null(False)
if self.do_upgrade_search:
condition &= self.model_file.Upgrade == False
else:
if self.quality_unmet_search and not self.custom_format_unmet_search:
condition &= (
self.model_file.Searched == False | self.model_file.QualityMet == False
)
elif not self.quality_unmet_search and self.custom_format_unmet_search:
condition &= (
self.model_file.Searched
== False | self.model_file.CustomFormatMet
== False
)
elif self.quality_unmet_search and self.custom_format_unmet_search:
condition &= (
self.model_file.Searched
== False | self.model_file.QualityMet
== False | self.model_file.CustomFormatMet
== False
)
else:
condition &= self.model_file.MovieFileId == 0
condition &= self.model_file.Searched == False
condition &= self.model_file.Year.is_null(False)
condition &= self.model_file.MovieFileId == 0
condition &= self.model_file.Searched == False
entries = list(
self.model_file.select()
.where(condition)
Expand Down Expand Up @@ -4731,7 +4687,7 @@ def run_request_search(self):
self.logger.debug("Waiting for active request search commands")
time.sleep(loop_delay)
self.request_search_timer = time.time()
return
return None
except NoConnectionrException as e:
self.logger.error(e.message)
raise DelayLoopException(length=300, type=e.type)
Expand Down

0 comments on commit d69afa4

Please sign in to comment.