From 0c0b045e68347903d0b8c37e6343071c29ea526f Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 6 Nov 2025 18:01:16 +0000 Subject: [PATCH 1/3] Add FHD and UHD support to stream quality matching Fix bug where FHD and UHD streams were not being matched to channels. The HARDCODED_IGNORE_PATTERNS were missing FHD and UHD in several regex patterns, causing streams like "BBC one FHD" to fail normalization and be excluded from matching results. Changes: - Add FHD and UHD to bracketed quality patterns: [FHD], [UHD], [fhd], [uhd] - Add FHD and UHD to unbracketed quality patterns at end: " FHD", " UHD" - Add FHD and UHD to parentheses patterns: (FHD), (UHD) - Add FHD and UHD to word boundary patterns: "FHD:", "UHD:" - Add UHD to STREAM_QUALITY_ORDER for proper quality sorting - Add UHD to CHANNEL_QUALITY_TAG_ORDER for channel prioritization This ensures streams with FHD/UHD quality tags are properly normalized and matched alongside HD and SD streams. Fixes issue where only HD and SD streams were matched while FHD streams were ignored. --- Stream-Mapparr/fuzzy_matcher.py | 12 ++++++------ Stream-Mapparr/plugin.py | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Stream-Mapparr/fuzzy_matcher.py b/Stream-Mapparr/fuzzy_matcher.py index b288aff..44b3b22 100644 --- a/Stream-Mapparr/fuzzy_matcher.py +++ b/Stream-Mapparr/fuzzy_matcher.py @@ -15,15 +15,15 @@ LOGGER = logging.getLogger("plugins.fuzzy_matcher") # Hardcoded regex patterns to ignore during fuzzy matching HARDCODED_IGNORE_PATTERNS = [ - r'\[(4K|FHD|HD|SD|Unknown|Unk|Slow|Dead)\]', - r'\[(?:4k|fhd|hd|sd|unknown|unk|slow|dead)\]', + r'\[(4K|UHD|FHD|HD|SD|Unknown|Unk|Slow|Dead)\]', + r'\[(?:4k|uhd|fhd|hd|sd|unknown|unk|slow|dead)\]', r'\([A-Z]\)', r'\s[Ee][Aa][Ss][Tt]', - r'\s(?:SD|HD|FD)\s', - r'\s(?:SD|HD|FD)$', - r'\b(?:SD|HD|FD|FHD):?\s', + r'\s(?:UHD|FHD|SD|HD|FD)\s', + r'\s(?:UHD|FHD|SD|HD|FD)$', + r'\b(?:UHD|FHD|SD|HD|FD):?\s', r'\s\(CX\)', - r'\s\((SD|HD|FD|Backup)\)', + r'\s\((UHD|FHD|SD|HD|FD|Backup)\)', r'\bUSA?:\s', r'\bUS\s', r'\([bB]ackup\)', diff --git a/Stream-Mapparr/plugin.py b/Stream-Mapparr/plugin.py index 543006e..c43482a 100644 --- a/Stream-Mapparr/plugin.py +++ b/Stream-Mapparr/plugin.py @@ -149,11 +149,11 @@ class Plugin: ] # Quality precedence order for channel tags - CHANNEL_QUALITY_TAG_ORDER = ["[4K]", "[FHD]", "[HD]", "[SD]", "[Unknown]", "[Slow]", ""] + CHANNEL_QUALITY_TAG_ORDER = ["[4K]", "[UHD]", "[FHD]", "[HD]", "[SD]", "[Unknown]", "[Slow]", ""] # Quality precedence order for stream tags (brackets and parentheses) STREAM_QUALITY_ORDER = [ - "[4K]", "(4K)", "4K", + "[4K]", "(4K)", "4K", "[UHD]", "(UHD)", "UHD", "[FHD]", "(FHD)", "FHD", "[HD]", "(HD)", "HD", "(H)", "[SD]", "(SD)", "SD", From 95df38905b8ef0be72318fc3fad07a0e4bf0d745 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 6 Nov 2025 18:04:33 +0000 Subject: [PATCH 2/3] Ensure consistent quality tag matching across all pattern types MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix inconsistency where some quality tags were only matched in bracketed format but not in unbracketed format, causing streams with unbracketed quality tags to be excluded from matching. Previous issue: - [4K], [Unknown], [Unk], [Slow], [Dead] were matched (bracketed) - But "4K", "Unknown", "Unk", "Slow", "Dead" were NOT matched (unbracketed) This caused streams like: - "BBC One 4K" (no brackets) - NOT normalized, NOT matched - "BBC One Unknown" - NOT normalized, NOT matched - "ESPN (Slow)" - NOT normalized, NOT matched Changes to HARDCODED_IGNORE_PATTERNS: - Added 4K, Unknown, Unk, Slow, Dead to middle pattern: " TAG " - Added 4K, Unknown, Unk, Slow, Dead to end pattern: " TAG" - Added 4K, Unknown, Unk, Slow, Dead to colon pattern: "TAG:" - Added 4K, Unknown, Unk, Slow, Dead to parentheses pattern: (TAG) - Added inline documentation for each pattern type - Note: All patterns already use re.IGNORECASE for case-insensitive matching Now ALL quality tags are handled consistently across: - Bracketed: [TAG] ✓ - Unbracketed at end: " TAG" ✓ - Unbracketed in middle: " TAG " ✓ - Parenthesized: (TAG) ✓ - With colon: "TAG:" ✓ This ensures no quality tags are missed regardless of format. --- Stream-Mapparr/fuzzy_matcher.py | 34 ++++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/Stream-Mapparr/fuzzy_matcher.py b/Stream-Mapparr/fuzzy_matcher.py index 44b3b22..ede3fa9 100644 --- a/Stream-Mapparr/fuzzy_matcher.py +++ b/Stream-Mapparr/fuzzy_matcher.py @@ -14,18 +14,38 @@ from glob import glob LOGGER = logging.getLogger("plugins.fuzzy_matcher") # Hardcoded regex patterns to ignore during fuzzy matching +# Note: All patterns are applied with re.IGNORECASE flag in normalize_name() HARDCODED_IGNORE_PATTERNS = [ + # Bracketed quality tags: [4K], [UHD], [FHD], [HD], [SD], [Unknown], [Unk], [Slow], [Dead] r'\[(4K|UHD|FHD|HD|SD|Unknown|Unk|Slow|Dead)\]', r'\[(?:4k|uhd|fhd|hd|sd|unknown|unk|slow|dead)\]', + + # Single letter tags in parentheses: (A), (B), (C), etc. r'\([A-Z]\)', + + # Regional: " East" or " east" r'\s[Ee][Aa][Ss][Tt]', - r'\s(?:UHD|FHD|SD|HD|FD)\s', - r'\s(?:UHD|FHD|SD|HD|FD)$', - r'\b(?:UHD|FHD|SD|HD|FD):?\s', - r'\s\(CX\)', - r'\s\((UHD|FHD|SD|HD|FD|Backup)\)', - r'\bUSA?:\s', - r'\bUS\s', + + # Unbracketed quality tags in middle: " 4K ", " UHD ", " FHD ", " HD ", " SD ", etc. + r'\s(?:4K|UHD|FHD|HD|SD|Unknown|Unk|Slow|Dead|FD)\s', + + # Unbracketed quality tags at end: " 4K", " UHD", " FHD", " HD", " SD", etc. + r'\s(?:4K|UHD|FHD|HD|SD|Unknown|Unk|Slow|Dead|FD)$', + + # Word boundary quality tags with optional colon: "4K:", "UHD:", "FHD:", "HD:", etc. + r'\b(?:4K|UHD|FHD|HD|SD|Unknown|Unk|Slow|Dead|FD):?\s', + + # Special tags + r'\s\(CX\)', # Cinemax tag + + # Parenthesized quality tags: (4K), (UHD), (FHD), (HD), (SD), (Unknown), (Unk), (Slow), (Dead), (Backup) + r'\s\((4K|UHD|FHD|HD|SD|Unknown|Unk|Slow|Dead|FD|Backup)\)', + + # Geographic prefixes + r'\bUSA?:\s', # "US:" or "USA:" + r'\bUS\s', # "US " at word boundary + + # Backup tags r'\([bB]ackup\)', ] From c8a982c4ab17ff3bc2d81d24831e99f07f7cb9a0 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 6 Nov 2025 18:06:49 +0000 Subject: [PATCH 3/3] Add Julian date version numbering to fuzzy_matcher.py Add __version__ constant using Julian date format: YY.DDD.HHMM - YY: Two-digit year (25 = 2025) - DDD: Day of year (310 = November 6th) - HHMM: Time in 24-hour format (1806 = 6:06 PM) Version: 25.310.1806 This provides a clear, sortable version number that indicates exactly when the last modification was made. --- Stream-Mapparr/fuzzy_matcher.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Stream-Mapparr/fuzzy_matcher.py b/Stream-Mapparr/fuzzy_matcher.py index ede3fa9..a00cf85 100644 --- a/Stream-Mapparr/fuzzy_matcher.py +++ b/Stream-Mapparr/fuzzy_matcher.py @@ -10,6 +10,9 @@ import json import logging from glob import glob +# Version: YY.DDD.HHMM (Julian date format: Year.DayOfYear.Time) +__version__ = "25.310.1806" + # Setup logging LOGGER = logging.getLogger("plugins.fuzzy_matcher")