From c2645000e521986f62fc3d80de32d26a7c68c380 Mon Sep 17 00:00:00 2001 From: GokuPlay609 <120821054+GokuPlay609@users.noreply.github.com> Date: Sun, 22 Feb 2026 20:55:36 +0530 Subject: [PATCH] fix: improve quality detection regex to match 2160p, UHD, FullHD and other keywords (#450) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## What Two-line fix to the quality detection regex in `media_manager/indexer/schemas.py`. **UHD pattern**: `\b(4k)\b` → `\b(4k|2160p|uhd)\b` **FullHD pattern**: `\b(1080p)\b` → `\b(1080p|fullhd|full\s*hd)\b` ## Why The UHD regex only matched the literal keyword `4k`. Torrent titles containing `2160p` or `UHD` (but not `4k`) were classified as `Quality.unknown` (value 5) instead of `Quality.uhd` (value 1). Since sorting uses quality as the primary key, these 4K releases ended up at the bottom of search results. ### Example | Title | Before | After | |---|---|---| | `Movie.2013.4K.HDR.2160p.x265` | ✅ `Quality.uhd` | ✅ `Quality.uhd` | | `Movie.2013.UHD.BluRay.2160p.HDR10.x265` | ❌ `Quality.unknown` | ✅ `Quality.uhd` | | `Movie.2013.2160p.WEBRip.DDP5.1.x264` | ❌ `Quality.unknown` | ✅ `Quality.uhd` | All patterns already use `re.IGNORECASE`, so case variants are handled. Fixes #449 --------- Co-authored-by: GokuPlay609 Co-authored-by: Amp Co-authored-by: maxid <97409287+maxdorninger@users.noreply.github.com> --- media_manager/indexer/schemas.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/media_manager/indexer/schemas.py b/media_manager/indexer/schemas.py index d0f61b1..0236da3 100644 --- a/media_manager/indexer/schemas.py +++ b/media_manager/indexer/schemas.py @@ -35,10 +35,10 @@ class IndexerQueryResult(BaseModel): @computed_field @property def quality(self) -> Quality: - high_quality_pattern = r"\b(4k)\b" - medium_quality_pattern = r"\b(1080p)\b" - low_quality_pattern = r"\b(720p)\b" - very_low_quality_pattern = r"\b(480p|360p)\b" + high_quality_pattern = r"\b(4k|2160p|uhd)\b" + medium_quality_pattern = r"\b(1080p|full[ ._-]?hd)\b" + low_quality_pattern = r"\b(720p|(?