Commit Graph

48 Commits

Author SHA1 Message Date
Claude
9caa91b01a Version bump to 0.5.1 and remove Channel Databases header
- Update plugin.py version from 0.5.0 to 0.5.1
- Update fuzzy_matcher.py version from 25.314.1907 to 25.317.1200
- Remove 📚 Channel Databases header field from settings (keep dynamic database fields)
2025-11-13 18:13:31 +00:00
Claude
55d493658e Fix fuzzy matcher producing false positive matches with 100% scores
Root cause: Stream names were normalizing to empty strings through
aggressive pattern stripping, causing multiple unrelated channels
(GNT, MTV, TLC, BIS, TNT, etc.) to incorrectly match each other
with 100% similarity scores.

Changes made:

1. Fixed calculate_similarity() to return 0.0 for empty string
   comparisons instead of 1.0, preventing false positives

2. Added validation in normalize_name() to log warnings when
   normalization results in empty strings

3. Added empty string checks (< 2 chars) in all matching stages:
   - fuzzy_match() Stage 1 (exact match)
   - fuzzy_match() Stage 2 (substring match)
   - find_best_match() (token-sort matching)

4. Added validation in plugin.py _match_streams_to_channel() to
   skip streams with empty/short cleaned names in:
   - Fuzzy matcher result collection
   - JSON exact match section
   - Basic substring matching fallback

5. Fixed country prefix regex pattern from [:|\s] to [:\s]
   (removed incorrect pipe and backslash characters)

Testing: Added comprehensive test suite (test_fuzzy_matcher_fix.py)
that verifies empty strings don't match and valid matches still work.
All tests pass.
2025-11-13 18:11:41 +00:00
Pirates IRC
be8c9dfce4 Update plugin.py 2025-11-11 14:03:57 -06:00
Pirates IRC
0b231546ec Merge pull request #13 from PiratesIRC/claude/change-logs-to-debug-011CV2hK7w3wNU6VEsdqWWuY
Change log entries from INFO to DEBUG
2025-11-11 14:03:32 -06:00
Claude
ac7bf7f978 Change verbose log entries from INFO to DEBUG level
Changed the following log entries to DEBUG level to reduce log verbosity:
- API request logs
- Page fetch progress logs
- Fuzzy matcher usage logs
- Fuzzy match result logs

These logs are useful for debugging but too verbose for normal operation.
2025-11-11 20:02:29 +00:00
Pirates IRC
07d27a811e IN dbase 2025-11-10 19:47:36 -06:00
Pirates IRC
ce9a8cc2a1 Merge pull request #12 from PiratesIRC/claude/add-github-version-checker-011CV1F3iesvv3HC5qVfsYLn
Claude/add GitHub version checker 011 cv1 f3iesvv3 hc5q vfs y ln
2025-11-10 19:46:58 -06:00
Pirates IRC
c7f58c5b08 Dbases for AU, BR, DE, ES, FR, MX, UK 2025-11-10 19:45:59 -06:00
Claude
ad085ebed4 Add .gitignore to exclude Python cache files 2025-11-11 01:41:41 +00:00
Claude
0853013665 Add GitHub version checker to Stream-Mapparr plugin
Implements automatic version checking that displays update status on the plugin settings page.

Features:
- Fetches latest release version from GitHub using stdlib (urllib.request)
- Displays version status at top of settings page (Update Available / Up to Date)
- Caches version check results for 24 hours to minimize API calls
- Re-checks automatically when plugin version changes
- Fails gracefully if network unavailable or GitHub API errors occur

Technical Details:
- Uses only Python standard library (no requests dependency)
- Version check triggered via fields property (runs when settings opened)
- Cache stored in /data/stream_mapparr_version_check.json
- Timeout set to 5 seconds for API requests
- All errors logged at debug level to avoid cluttering logs
2025-11-11 01:40:24 +00:00
Pirates IRC
a71e8f0382 Merge pull request #11 from PiratesIRC/claude/selectable-channel-databases-011CV1BxggpwpUe3u86UDzvN
Add selectable channel databases to GUI
2025-11-10 19:34:52 -06:00
Claude
b625e4f55b Add channel database validation and CSV improvements
Enhancements:
- Add database validation to settings validation
  * Checks if at least one database file exists
  * Validates JSON format of enabled databases
  * Ensures at least one database is enabled
  * Reports invalid/malformed database files

- Add database information to CSV exports
  * Show which database was used for each channel match
  * Add "database_used" column to preview and update CSVs
  * Include enabled databases list in CSV header comments
  * Track database source through matching pipeline

- Shorten validation success message
  * Condensed format with key info only
  * Separate success items and info items
  * More readable for small notification areas
  * Shows database count in validation results

Changes to _match_streams_to_channel():
- Now returns 5-tuple: (streams, cleaned_name, cleaned_stream_names, match_reason, database_used)
- Tracks country_code from channel database entry
- Returns "N/A" if channel not found in any database

CSV export improvements:
- Preview CSV includes database_used column
- Update CSV includes database_used column
- Header comments show: "Channel Databases Loaded: [list]"
2025-11-11 01:33:59 +00:00
Claude
f62a8f275f Update versions: plugin to 0.5.0a, fuzzy_matcher to 25.314.1907
- Update plugin.py version from 0.6.0 to 0.5.0a
- Update fuzzy_matcher.py version to 25.314.1907 (Nov 10, 2025 19:07)
- Update all references to v0.6.0 in README.md to v0.5.0a
2025-11-11 01:09:41 +00:00
Claude
2414407291 Fix country prefix handling to not affect other plugins
Changed approach from modifying global GEOGRAPHIC_PATTERNS (which affects
all plugins using fuzzy_matcher.py) to adding a new optional parameter.

Changes:
- Reverted GEOGRAPHIC_PATTERNS to original US-only patterns
- Added new remove_country_prefix parameter to normalize_name() (default: False)
- Updated _clean_channel_name() to use remove_country_prefix=True by default
- Implemented smart prefix detection that avoids removing quality tags (HD, SD, UHD, FHD)
- Added fallback country prefix removal in basic cleaning code
- Updated README to clarify country code prefix handling approach

This ensures backward compatibility for other plugins while enabling
multi-country support for Stream-Mapparr.
2025-11-11 01:07:59 +00:00
Claude
f1d7b1472e Add selectable channel databases feature (v0.6.0)
This update introduces GUI-based channel database management, allowing users to enable or disable specific country databases for channel matching.

Key Changes:
- Convert fields from static list to @property method for dynamic database detection
- Add _get_channel_databases() method to scan and extract database metadata
- Update _load_channels_data() to filter by enabled databases from settings
- Support new database format with country_code, country_name, and version metadata
- Maintain backward compatibility with legacy array format
- Add dynamic checkbox fields for each detected database in plugin settings
- Default behavior: US enabled, all others disabled (or enable if only one database exists)
- Update fuzzy_matcher.py GEOGRAPHIC_PATTERNS to handle any country code prefix (CC:, CC , CCC:, CCC )
- Add comprehensive README documentation for new database format and GUI management
- Include sample CA_channels.json demonstrating new metadata format

Features:
- Selectable channel databases through GUI settings
- Multi-country support with automatic country code prefix handling
- Clear database labels showing country name and version in settings
- Improved matching accuracy by enabling only relevant regional databases

Version: 0.6.0
2025-11-11 01:04:59 +00:00
Pirates IRC
38ae6893c0 Merge pull request #10 from PiratesIRC/claude/add-channel-database-directions-011CV19PQS7oT6PoVbTVKtzP
Add channel database setup instructions to README
2025-11-10 18:22:44 -06:00
Claude
62bccdcdc1 Add channel database creation instructions for other countries
- Document the *_channels.json file format and naming pattern
- Provide step-by-step guide for creating country-specific databases
- Include field descriptions and examples (UK_channels.json)
- Add Docker commands for installation and verification
- Include tips for better channel matching
2025-11-11 00:22:00 +00:00
Pirates IRC
920944a58d Merge pull request #9 from PiratesIRC/claude/check-ignore-tags-quotes-011CUxoQJQutkJKHfvcp7REN
Check tag ignore option quotation format
2025-11-09 12:41:02 -06:00
Claude
26d3c2e618 Add quotation support for Ignore Tags field
- Update field description and placeholder to show quotation usage
- Add _parse_tags() static method to parse comma-separated tags with quote support
- Support both single and double quotes to preserve spaces and special characters
- Update all ignore_tags parsing locations to use new helper function
- Examples: "4K, \" East\", \"[Dead]\"" -> ["4K", " East", "[Dead]"]
2025-11-09 18:40:17 +00:00
Pirates IRC
ae7c6c8e5f Merge pull request #8 from PiratesIRC/claude/refactor-fuzzy-matcher-patterns-011CUxkNHWBdVdAHJqGaYfNH
Refactor fuzzy_matcher pattern categorization and normalization
2025-11-09 12:36:25 -06:00
Claude
c2f2e0c03a Add validation to Load/Process and Preview actions, update to v0.5.0d
Changes:
1. Extract validation logic into _validate_plugin_settings helper method:
   - Returns (has_errors, validation_results, token) tuple
   - Validates API connection, profiles, groups, thresholds, etc.
   - Reusable across multiple action methods

2. Update validate_settings_action:
   - Now calls _validate_plugin_settings helper
   - Formats results for UI display

3. Add validation to load_process_channels_action:
   - Validates settings before loading channels
   - Prevents processing with invalid profiles or groups
   - Returns clear error messages if validation fails

4. Add validation to preview_changes_action:
   - Validates settings before previewing changes
   - Ensures settings are still valid when preview is run
   - Returns clear error messages if validation fails

5. Update version to 0.5.0d

Benefits:
- Prevents users from proceeding with invalid settings
- Provides immediate feedback on configuration errors
- Ensures channel profiles and groups exist before processing
- Improves user experience with clear error messages
- Maintains DRY principle with shared validation logic
2025-11-09 18:12:59 +00:00
Claude
5e5d3ed49d Integrate category-based pattern control in Stream-Mapparr plugin
Changes:
1. Add four new UI settings for granular pattern control:
   - ignore_quality_tags: Control quality pattern removal ([4K], HD, etc.)
   - ignore_regional_tags: Control regional pattern removal (East)
   - ignore_geographic_tags: Control geographic prefix removal (US:, USA:)
   - ignore_misc_tags: Control miscellaneous pattern removal ((CX), (Backup), etc.)

2. Update _clean_channel_name method:
   - Add parameters: ignore_quality, ignore_regional, ignore_geographic, ignore_misc
   - Pass these to fuzzy_matcher.normalize_name
   - Defaults to True for backward compatibility

3. Update _match_streams_to_channel method:
   - Accept category flag parameters
   - Pass them through to all _clean_channel_name calls

4. Store category settings in processed_data:
   - Save settings when loading/processing channels
   - Retrieve settings when executing actions
   - Apply settings consistently across all operations

5. Update all action methods:
   - preview_changes_action
   - add_streams_to_channels_action
   - manage_channel_visibility_action
   - All retrieve and use category settings from processed_data

This enables users to fine-tune pattern matching behavior through the UI
while maintaining full backward compatibility with existing configurations.
2025-11-09 18:09:13 +00:00
Claude
4e794879e5 Refactor fuzzy matcher patterns for granular control
Changes:
1. Categorize HARDCODED_IGNORE_PATTERNS into 4 distinct lists:
   - QUALITY_PATTERNS: Quality tags ([4K], HD, (SD), etc.)
   - REGIONAL_PATTERNS: Regional indicators (East)
   - GEOGRAPHIC_PATTERNS: Geographic prefixes (US:, USA:)
   - MISC_PATTERNS: Miscellaneous patterns ((CX), (Backup), single-letter tags)

2. Update normalize_name function signature:
   - Remove remove_quality_tags parameter
   - Add ignore_quality, ignore_regional, ignore_geographic, ignore_misc (all default to True)
   - Maintains backward compatibility with default True values

3. Implement dynamic pattern application:
   - Build patterns_to_apply list based on category flags
   - Apply only selected pattern categories

4. Improve user_ignored_tags handling:
   - Tags with brackets/parentheses: literal match
   - Simple word tags: use word boundaries (\b) to avoid partial matches
   - Fixes issue where "East" tag would incorrectly match "east" in "Feast"

5. Update version to 25.313.1157 (Julian date: Nov 9, 2025 11:57 AM)

This refactoring enables future UI controls for granular pattern filtering
while maintaining full backward compatibility.
2025-11-09 18:01:25 +00:00
Pirates IRC
2b60dc0eb2 Merge pull request #7 from PiratesIRC/claude/multi-profile-validation-csv-headers-011CUvkSt1wZzVhCwFmCN7vw
Add multi-profile support and CSV comment headers
2025-11-08 10:50:55 -06:00
Claude
066c9cf956 Add multi-profile support, settings validation, and CSV headers
Features:
- Multi-profile support: Profile Name field now accepts comma-separated list
- Validate Settings button: New first action to validate all settings
  - Checks API connection
  - Validates all profiles exist
  - Validates all groups exist
  - Verifies fuzzy matcher initialization
- CSV headers: All generated CSV files now include comment headers with:
  - Plugin version
  - All applicable settings (Overwrite, Threshold, Profiles, Groups, Tags, Limit)
  - Statistics (visible channels, total streams, matched streams)

Changes:
- Updated Profile Name field help text and placeholder
- Modified load_process_channels_action to handle multiple profiles
- Added validate_settings_action method with comprehensive validation
- Added _generate_csv_header_comment helper method
- Updated all three CSV exports (preview, update, visibility) to include headers
2025-11-08 16:43:09 +00:00
Pirates IRC
ba90a0aaa0 0.5.0b 2025-11-08 10:13:44 -06:00
Pirates IRC
dc603625d8 Merge pull request #6 from PiratesIRC/claude/debug-issue-011CUrxaBXUrfZBk1W1XDBVp
Debug and fix code issues
2025-11-08 10:11:36 -06:00
Claude
c8a982c4ab 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.
2025-11-06 18:06:49 +00:00
Claude
95df38905b Ensure consistent quality tag matching across all pattern types
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.
2025-11-06 18:04:33 +00:00
Claude
0c0b045e68 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.
2025-11-06 18:01:16 +00:00
Pirates IRC
765266a51e Merge pull request #5 from PiratesIRC/claude/fuzzymatcher-ignore-cinemax-011CUrk7Kz5VHK1xuFeNzKbs
Fix fuzzymatcher to ignore Cinemax in channel names
2025-11-06 07:53:34 -06:00
Claude
2d9cf4347c Improve Cinemax removal regex in fuzzy matcher
- Updated regex from '\bCinemax\s+' to '\bCinemax\b\s*'
- Now handles edge cases like Cinemax at end of string
- Matches Cinemax as complete word with optional trailing spaces
- Ensures proper matching for channels containing 'max'
2025-11-06 13:52:45 +00:00
Pirates IRC
9b71b20293 Merge pull request #4 from PiratesIRC/claude/fix-visibility-add-emojis-011CUrgQDHW2FZ25e9XdPjNi
Claude/fix visibility add emojis 011 c urg qdhw2 fz25e9 xd pj ni
2025-11-06 07:35:43 -06:00
Claude
ec65d904a1 Remove WebSocket notifications from plugin
The WebSocket notifications require frontend handlers in Dispatcharr's
WebSocket.jsx that cannot be added from the plugin code. Removed all
send_websocket_update() calls to avoid sending notifications that won't
be displayed.

The plugin still logs progress to the console for debugging.

Changes:
- Remove import of send_websocket_update
- Remove all WebSocket notification calls from:
  * preview_changes_action
  * add_streams_to_channels_action
  * manage_channel_visibility_action
- Progress is still logged via standard logging
2025-11-06 13:34:42 +00:00
Claude
05860d3a2f Add Cinemax handling for channels containing 'max'
When a channel name contains "max" (case insensitive), the plugin
now removes "Cinemax" from stream names during matching. This allows
channels like "5StarMax" to properly match streams like:
- US: Cinemax 5Starmax
- US 5STARMAX (East) (H)
- US: 5 STARMAX

Changes:
- Add remove_cinemax parameter to normalize_name() in fuzzy_matcher.py
- Add remove_cinemax parameter to _clean_channel_name() in plugin.py
- Detect if channel name contains "max" in _match_streams_to_channel()
- Pass remove_cinemax=True to all stream name cleaning when applicable
- Update fuzzy_match() and find_best_match() to support Cinemax removal

This improves matching accuracy for Cinemax channels that include
the network name in stream names but not in channel names.
2025-11-06 13:26:15 +00:00
Claude
03b8bfc31e Add emojis, fix visibility logic, and add WebSocket notifications
Changes:
- Add tasteful emojis to plugin GUI fields and action labels
- Fix bug: iterate sorted_channels instead of group_channels (line 1411)
- Fix visibility logic: enable channels with >= 1 streams instead of 0-1
  * Channels with >= 1 streams are now enabled (highest priority only)
  * Channels with 0 streams are disabled
  * Duplicate channels (lower priority in group) are disabled
  * Attached channels remain disabled
- Add real-time WebSocket progress notifications for:
  * Preview Changes action (stream_mapparr_preview)
  * Add Streams to Channels action (stream_mapparr_add)
  * Manage Channel Visibility action (stream_mapparr_visibility)
- Update action descriptions to reflect corrected behavior

This resolves the contradiction where add_streams_to_channels would
create channels with multiple streams, and manage_channel_visibility
would immediately disable them.
2025-11-06 13:11:31 +00:00
Pirates IRC
8b75a7e296 Merge pull request #3 from PiratesIRC/claude/debug-stream-count-error-011CUm6dug1DMDcmxEoHQcXB
Fix KeyError: 'stream_count' in manage_channel_visibility
2025-11-03 08:22:04 -06:00
Claude
331355e846 Fix KeyError: 'stream_count' in manage_channel_visibility
Root cause: Lines 1414-1415 were trying to access non-existent fields
'stream_count' and 'attached' directly from channel objects. These values
are actually stored in the channel_stream_counts dictionary and
channels_attached_to_others set respectively.

Changes:
- Fixed field access to use correct data structures
- Added error handling to check if channel exists in stream_counts
- Added debug logging to show evaluation details for each channel
- Added full traceback logging in exception handler for better debugging

This fixes the error: "Error managing channel visibility: 'stream_count'"
2025-11-03 14:20:05 +00:00
Pirates IRC
ac6f377636 0.5.0a 2025-11-03 08:16:16 -06:00
Pirates IRC
09d1651a14 v0.4 2025-10-31 16:06:38 -05:00
Pirates IRC
b296babff2 Revise README for improved clarity and detail
Updated README to enhance clarity and detail regarding plugin features, installation, and usage instructions.
2025-10-31 16:06:00 -05:00
Pirates IRC
faa35afebe Update README.md 2025-10-24 06:47:40 -05:00
Pirates IRC
5b51c64ced v0.3 2025-10-24 06:37:21 -05:00
Pirates IRC
85225fcf50 Update README.md 2025-10-09 11:46:18 -05:00
Pirates IRC
6430fe0745 v0.2 2025-10-09 11:30:19 -05:00
Pirates IRC
a07dda69ee Initial 2025-10-01 19:01:07 -05:00
Pirates IRC
80e3e5c7d3 Update README.md 2025-10-01 19:00:19 -05:00
Pirates IRC
fae5e86b25 Initial commit 2025-10-01 18:55:11 -05:00