Merge pull request #6 from PiratesIRC/claude/debug-issue-011CUrxaBXUrfZBk1W1XDBVp

Debug and fix code issues
This commit is contained in:
Pirates IRC
2025-11-08 10:11:36 -06:00
committed by GitHub
2 changed files with 34 additions and 11 deletions

View File

@@ -10,22 +10,45 @@ 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")
# Hardcoded regex patterns to ignore during fuzzy matching
# Note: All patterns are applied with re.IGNORECASE flag in normalize_name()
HARDCODED_IGNORE_PATTERNS = [
r'\[(4K|FHD|HD|SD|Unknown|Unk|Slow|Dead)\]',
r'\[(?:4k|fhd|hd|sd|unknown|unk|slow|dead)\]',
# 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(?:SD|HD|FD)\s',
r'\s(?:SD|HD|FD)$',
r'\b(?:SD|HD|FD|FHD):?\s',
r'\s\(CX\)',
r'\s\((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\)',
]

View File

@@ -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",