Compatibility for Dispatcharr 0.2x

This commit is contained in:
Pirates IRC
2026-03-09 04:17:59 -05:00
committed by GitHub
parent 2c3cbf1155
commit c1135eb8a0
3 changed files with 218 additions and 954 deletions

View File

@@ -12,7 +12,7 @@ import unicodedata
from glob import glob from glob import glob
# Version: YY.DDD.HHMM (Julian date format: Year.DayOfYear.Time) # Version: YY.DDD.HHMM (Julian date format: Year.DayOfYear.Time)
__version__ = "25.358.0200" __version__ = "26.018.0100"
# Setup logging # Setup logging
LOGGER = logging.getLogger("plugins.fuzzy_matcher") LOGGER = logging.getLogger("plugins.fuzzy_matcher")
@@ -346,17 +346,26 @@ class FuzzyMatcher:
# Store original for logging # Store original for logging
original_name = name original_name = name
# CRITICAL FIX: Normalize spacing around numbers FIRST, before any other processing # CRITICAL FIX (v25.019.0100): Apply quality patterns FIRST, before space normalization
# This prevents space normalization from breaking quality tags like "4K" -> "4 K"
# which would then fail to match quality patterns looking for "4K"
# Bug: Streams with "4K" suffix were not matching because "4K" was split to "4 K"
# by the space normalization step, then quality patterns couldn't find "4K" at end
if ignore_quality:
for pattern in QUALITY_PATTERNS:
name = re.sub(pattern, '', name, flags=re.IGNORECASE)
# Normalize spacing around numbers (AFTER quality patterns are removed)
# This ensures "ITV1" and "ITV 1" are treated identically during matching # This ensures "ITV1" and "ITV 1" are treated identically during matching
# Pattern: Insert space before number if preceded by letter, and after number if followed by letter # Pattern: Insert space before number if preceded by letter, and after number if followed by letter
# Examples: "ITV1" -> "ITV 1", "BBC2" -> "BBC 2", "E4" -> "E 4" # Examples: "ITV1" -> "ITV 1", "BBC2" -> "BBC 2", "E4" -> "E 4"
name = re.sub(r'([a-zA-Z])(\d)', r'\1 \2', name) # Letter followed by digit name = re.sub(r'([a-zA-Z])(\d)', r'\1 \2', name) # Letter followed by digit
name = re.sub(r'(\d)([a-zA-Z])', r'\1 \2', name) # Digit followed by letter name = re.sub(r'(\d)([a-zA-Z])', r'\1 \2', name) # Digit followed by letter
# CRITICAL FIX: Normalize hyphens to spaces for better token matching # Normalize hyphens to spaces for better token matching
# This ensures "UK-ITV" becomes "UK ITV" and matches properly # This ensures "UK-ITV" becomes "UK ITV" and matches properly
# Common patterns: "UK-ITV 1", "US-CNN", etc. # Common patterns: "UK-ITV 1", "US-CNN", etc.
name = re.sub(r'-', ' ', name) # Digit followed by letter name = re.sub(r'-', ' ', name)
# Remove ALL leading parenthetical prefixes like (US) (PRIME2), (SP2), (D1), etc. # Remove ALL leading parenthetical prefixes like (US) (PRIME2), (SP2), (D1), etc.
# Loop until no more leading parentheses are found # Loop until no more leading parentheses are found
@@ -386,11 +395,10 @@ class FuzzyMatcher:
name = re.sub(r'\bCinemax\b\s*', '', name, flags=re.IGNORECASE) name = re.sub(r'\bCinemax\b\s*', '', name, flags=re.IGNORECASE)
# Build list of patterns to apply based on category flags # Build list of patterns to apply based on category flags
# NOTE: Quality patterns are now applied earlier (before space normalization)
# to prevent "4K" from being split to "4 K" before removal
patterns_to_apply = [] patterns_to_apply = []
if ignore_quality:
patterns_to_apply.extend(QUALITY_PATTERNS)
if ignore_regional: if ignore_regional:
patterns_to_apply.extend(REGIONAL_PATTERNS) patterns_to_apply.extend(REGIONAL_PATTERNS)

View File

@@ -1,16 +1,44 @@
{ {
"name": "Stream-Mapparr", "name": "Stream-Mapparr",
"key": "stream-mapparr", "version": "0.8.0a",
"module": "stream_mapparr.plugin",
"class": "Plugin",
"description": "Automatically add matching streams to channels based on name similarity and quality precedence. Supports unlimited stream matching, channel visibility management, and CSV export cleanup.", "description": "Automatically add matching streams to channels based on name similarity and quality precedence. Supports unlimited stream matching, channel visibility management, and CSV export cleanup.",
"author": "community", "author": "community",
"homepage": "https://github.com/PiratesIRC/Stream-Mapparr", "help_url": "https://github.com/PiratesIRC/Stream-Mapparr",
"fields": [
{"id": "overwrite_streams", "label": "Overwrite Existing Streams", "type": "boolean", "default": true},
{"id": "fuzzy_match_threshold", "label": "Fuzzy Match Threshold", "type": "number", "default": 85},
{"id": "profile_name", "label": "Profile Name", "type": "string", "default": ""},
{"id": "selected_groups", "label": "Channel Groups", "type": "string", "default": ""},
{"id": "selected_stream_groups", "label": "Stream Groups", "type": "string", "default": ""},
{"id": "selected_m3us", "label": "M3U Sources", "type": "string", "default": ""},
{"id": "prioritize_quality", "label": "Prioritize Quality Before Source", "type": "boolean", "default": false},
{"id": "ignore_tags", "label": "Ignore Tags", "type": "string", "default": ""},
{"id": "ignore_quality_tags", "label": "Ignore Quality Tags", "type": "boolean", "default": true},
{"id": "ignore_regional_tags", "label": "Ignore Regional Tags", "type": "boolean", "default": true},
{"id": "ignore_geographic_tags", "label": "Ignore Geographic Tags", "type": "boolean", "default": true},
{"id": "ignore_misc_tags", "label": "Ignore Misc Tags", "type": "boolean", "default": true},
{"id": "visible_channel_limit", "label": "Visible Channel Limit", "type": "number", "default": 1},
{"id": "rate_limiting", "label": "Rate Limiting", "type": "select", "default": "none"},
{"id": "timezone", "label": "Timezone", "type": "select", "default": "US/Central"},
{"id": "filter_dead_streams", "label": "Filter Dead Streams", "type": "boolean", "default": false},
{"id": "wait_for_iptv_checker", "label": "Wait for IPTV Checker", "type": "boolean", "default": false},
{"id": "iptv_checker_max_wait_hours", "label": "IPTV Checker Max Wait", "type": "number", "default": 6},
{"id": "dry_run_mode", "label": "Dry Run Mode", "type": "boolean", "default": false},
{"id": "scheduled_times", "label": "Scheduled Run Times", "type": "string", "default": ""},
{"id": "scheduled_sort_streams", "label": "Schedule Sort Streams", "type": "boolean", "default": false},
{"id": "scheduled_match_streams", "label": "Schedule Match Streams", "type": "boolean", "default": true},
{"id": "enable_scheduled_csv_export", "label": "Enable CSV Export", "type": "boolean", "default": true}
],
"actions": [ "actions": [
"load_process_channels", {"id": "validate_settings", "label": "Validate Settings", "description": "Check database connectivity, profiles, groups, and channel databases"},
"preview_changes", {"id": "update_schedule", "label": "Update Schedule", "description": "Save settings and restart background scheduler"},
"add_streams_to_channels", {"id": "load_process_channels", "label": "Load/Process Channels", "description": "Load channel and stream data from database"},
"manage_channel_visibility", {"id": "preview_changes", "label": "Preview Changes", "description": "Generate CSV preview without making changes"},
"clear_csv_exports" {"id": "add_streams_to_channels", "label": "Match & Assign Streams", "description": "Match and assign streams to channels"},
{"id": "match_us_ota_only", "label": "Match US OTA Only", "description": "Match US OTA channels by callsign"},
{"id": "sort_streams", "label": "Sort Alternate Streams", "description": "Sort existing alternate streams by quality"},
{"id": "manage_channel_visibility", "label": "Manage Channel Visibility", "description": "Enable/disable channels based on stream count"},
{"id": "clear_csv_exports", "label": "Clear CSV Exports", "description": "Delete all plugin CSV export files"},
{"id": "clear_operation_lock", "label": "Clear Operation Lock", "description": "Manually clear stuck operation lock"}
] ]
} }

File diff suppressed because it is too large Load Diff