From 7a43529ffabffbae03dd1cd53670226a2e615591 Mon Sep 17 00:00:00 2001 From: miigotu Date: Wed, 31 Jan 2024 23:17:34 -0500 Subject: [PATCH] fix: prevent results with a quality of 0 (NONE) from being set as preferred in duplicates for nzb Signed-off-by: miigotu --- sickchill/oldbeard/nzbget.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/sickchill/oldbeard/nzbget.py b/sickchill/oldbeard/nzbget.py index c63d044762..0f2975dc41 100644 --- a/sickchill/oldbeard/nzbget.py +++ b/sickchill/oldbeard/nzbget.py @@ -78,14 +78,16 @@ def send_nzb(result: "SearchResult", proper=False) -> bool: if result.show.quality and dupe_score: allowed_qualities, preferred_qualities = Quality.splitQuality(result.show.quality) - if result.quality == max(preferred_qualities, default=0): - dupe_score *= 1000 - elif result.quality in preferred_qualities: - dupe_score *= 800 - elif result.quality == max(allowed_qualities): - dupe_score *= 500 - elif result.quality in allowed_qualities: - dupe_score *= 300 + if preferred_qualities: + if result.quality == max(preferred_qualities): + dupe_score *= 1000 + elif result.quality in preferred_qualities: + dupe_score *= 800 + elif allowed_qualities: + if result.quality == max(allowed_qualities): + dupe_score *= 500 + elif result.quality in allowed_qualities: + dupe_score *= 300 elif dupe_score and dupe_score != Quality.UNKNOWN: dupe_score *= 100