From 6349562294194d88515bd96ea58ca6cd637d415e Mon Sep 17 00:00:00 2001 From: fredhen <13823183+fredhen@users.noreply.github.com> Date: Tue, 10 Dec 2024 15:12:09 +0200 Subject: [PATCH] Don't replace allowed quality unless from preferred quality (#11711) * Don't replace allowed quality unless from preferred quality * Update common.py * Update common.py * Update common.py * Update test_should_replace.py --------- Co-authored-by: Dario --- medusa/common.py | 5 +---- tests/test_should_replace.py | 4 ++-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/medusa/common.py b/medusa/common.py index 46f2a33b11..322687199b 100644 --- a/medusa/common.py +++ b/medusa/common.py @@ -615,10 +615,7 @@ def should_replace(ep_status, old_quality, new_quality, allowed_qualities, prefe if new_quality in preferred_qualities: return True, 'New quality is preferred. Accepting new quality' - if new_quality > old_quality: - return True, 'New quality is higher quality (and allowed). Accepting new quality' - else: - return False, 'New quality is same/lower quality (and not preferred). Ignoring new quality' + return False, 'Existing quality is allowed and new quality is not a preferred quality. Ignoring new quality' else: # Allowed quality should never be replaced diff --git a/tests/test_should_replace.py b/tests/test_should_replace.py index 484eae89f7..a360307288 100644 --- a/tests/test_should_replace.py +++ b/tests/test_should_replace.py @@ -74,7 +74,7 @@ 'manually_searched': False, 'expected': False }, - { # p6: Snatched Proper 720p HDTV and found 720p BluRay, and 720p BluRay is not preferred but allowed: yes + { # p6: Snatched Proper 720p HDTV and found 720p BluRay, and 720p BluRay is not preferred but allowed: no 'ep_status': SNATCHED_PROPER, 'cur_quality': Quality.HDTV, 'new_quality': Quality.HDBLURAY, @@ -83,7 +83,7 @@ 'download_current_quality': False, 'force': False, 'manually_searched': False, - 'expected': True + 'expected': False }, { # p7: Downloaded 720p HDTV and found 720p BluRay, 720p BluRay is not explicity allowed but it's preferred: yes 'ep_status': DOWNLOADED,