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
This commit is contained in:
Claude
2025-11-11 01:04:59 +00:00
parent 38ae6893c0
commit f1d7b1472e
4 changed files with 515 additions and 165 deletions

154
README.md
View File

@@ -15,6 +15,8 @@ Before installing or using this plugin, it is **highly recommended** that you cr
* **Advanced Fuzzy Matching**: Automatically finds and assigns streams to channels using an advanced fuzzy-matching engine (`fuzzy_matcher.py`).
* **Unlimited Stream Support**: Fetches and processes ALL available streams regardless of quantity (no 10,000 stream limit).
* **Enhanced OTA Callsign Matching**: Uses a robust `*_channels.json` database for superior callsign extraction and matching for Over-The-Air broadcast channels.
* **Selectable Channel Databases** *(NEW v0.6.0)*: Enable or disable specific channel databases through the GUI settings.
* **Multi-Country Support** *(NEW v0.6.0)*: Support for multiple country databases with automatic country code prefix handling (e.g., `CA:`, `UK `).
* **Multi-Stream Assignment**: Assigns **all** matching streams to each channel (e.g., 4K, FHD, HD versions), sorted by quality.
* **Quality Prioritization**: Sorts matched streams by quality (4K → FHD → HD → (H) → (F) → (D) → SD → Slow).
* **Channel Visibility Management**: Automatically enables/disables channels based on stream assignments and duplicate detection.
@@ -44,11 +46,44 @@ Before installing or using this plugin, it is **highly recommended** that you cr
Stream-Mapparr uses `*_channels.json` files to improve OTA (Over-The-Air) and cable channel matching. The plugin includes `US_channels.json` by default, but you can create additional database files for other countries or regions.
**NEW in v0.6.0**: Channel databases are now **selectable within the GUI**! You can enable or disable specific databases in the plugin settings.
### Database File Format
Channel database files follow the naming pattern: `[COUNTRY_CODE]_channels.json` (e.g., `US_channels.json`, `CA_channels.json`, `UK_channels.json`)
Each file contains a JSON array of channel objects with three required fields:
#### Recommended Format (v0.6.0+)
The recommended format includes metadata at the top level:
```json
{
"country_code": "CA",
"country_name": "Canada",
"version": "2025-11-10",
"channels": [
{
"channel_name": "CBC",
"category": "News",
"type": "National"
},
{
"channel_name": "CTV",
"category": "Entertainment",
"type": "National"
},
{
"channel_name": "Global",
"category": "Entertainment",
"type": "National"
}
]
}
```
#### Legacy Format (Still Supported)
The legacy format is still supported and uses a direct array:
```json
[
@@ -61,17 +96,25 @@ Each file contains a JSON array of channel objects with three required fields:
"channel_name": "CTV",
"category": "Entertainment",
"type": "National"
},
{
"channel_name": "Global",
"category": "Entertainment",
"type": "National"
}
]
```
**Note**: If using the legacy format without metadata, the database will be displayed in settings using the filename.
### Field Descriptions
#### Metadata Fields (Recommended Format Only)
| Field | Required | Description | Examples |
|:---|:---|:---|:---|
| **country_code** | Recommended | Two-letter ISO country code | `US`, `CA`, `UK`, `AU`, `DE` |
| **country_name** | Recommended | Full country/region name | `United States`, `Canada`, `United Kingdom` |
| **version** | Optional | Database version or date | `2025-11-10`, `1.0`, `v2` |
| **channels** | Yes | Array of channel objects | See below |
#### Channel Object Fields
| Field | Required | Description | Examples |
|:---|:---|:---|:---|
| **channel_name** | Yes | The channel name or callsign | `CBC`, `BBC One`, `WSBT`, `Sky Sports` |
@@ -113,58 +156,97 @@ Each file contains a JSON array of channel objects with three required fields:
```
* The plugin will automatically detect and use all `*_channels.json` files in the directory
### Example: Creating UK_channels.json
### Example: Creating UK_channels.json (Recommended Format)
```json
[
{
"channel_name": "BBC One",
"category": "Entertainment",
"type": "National"
},
{
"channel_name": "BBC Two",
"category": "Entertainment",
"type": "National"
},
{
"channel_name": "ITV",
"category": "Entertainment",
"type": "National"
},
{
"channel_name": "Channel 4",
"category": "Entertainment",
"type": "National"
},
{
"channel_name": "Sky Sports",
"category": "Sports",
"type": "National"
}
]
{
"country_code": "UK",
"country_name": "United Kingdom",
"version": "2025-11-11",
"channels": [
{
"channel_name": "BBC One",
"category": "Entertainment",
"type": "National"
},
{
"channel_name": "BBC Two",
"category": "Entertainment",
"type": "National"
},
{
"channel_name": "ITV",
"category": "Entertainment",
"type": "National"
},
{
"channel_name": "Channel 4",
"category": "Entertainment",
"type": "National"
},
{
"channel_name": "Sky Sports",
"category": "Sports",
"type": "National"
}
]
}
```
### Managing Channel Databases in the GUI
**NEW in v0.6.0**: All channel databases are now manageable through the plugin settings!
1. **Viewing Available Databases**
* Navigate to **Plugins** → **Stream-Mapparr** → **Settings**
* Scroll to the **"📚 Channel Databases"** section
* All detected `*_channels.json` files will be listed with checkboxes
2. **Enabling/Disabling Databases**
* Check the box next to a database to enable it for matching
* Uncheck the box to disable it
* By default, only the **US** database is enabled
* If only one database exists, it will be enabled by default
3. **Database Labels**
* Databases using the **recommended format** show: `Country Name (vVersion)`
* Example: `Canada (v2025-11-10)`
* Databases using the **legacy format** show: `Filename`
* Example: `UK_channels.json`
4. **Country Code Prefix Handling**
* Stream names may be prefixed with country codes (e.g., `CA: CBC`, `UK BBC One`)
* The plugin automatically removes these prefixes during matching
* Supported formats: `CC:`, `CC `, `CCC:`, or `CCC ` (where C = letter)
### Tips for Better Matching
* Include all variations of channel names (e.g., `BBC 1`, `BBC One`, `BBC1`)
* Add both full names and abbreviations (e.g., `The Sports Network`, `TSN`)
* Include regional variants if applicable (e.g., `BBC One London`, `BBC One Scotland`)
* Use the exact callsigns for OTA broadcast stations
* Test your database by running the plugin and checking the logs for matching activity
* Enable only the databases relevant to your region for better matching accuracy
* Use the recommended format with metadata for clearer identification in the GUI
* Test your database by enabling it in settings and checking the logs for matching activity
## Settings Reference
| Setting | Type | Default | Description |
|:---|:---|:---|:---|
| **Fuzzy Match Threshold** | `number` | 85 | Minimum similarity score (0-100) for fuzzy matching. Higher values require closer matches. |
| **Overwrite Existing Streams** | `boolean` | True | If enabled, removes all existing streams and replaces with matched streams |
| **Fuzzy Match Threshold** | `number` | 85 | Minimum similarity score (0-100) for fuzzy matching. Higher values require closer matches |
| **Dispatcharr URL** | `string` | - | Full URL of your Dispatcharr instance (e.g., `http://192.168.1.10:9191`) |
| **Dispatcharr Admin Username** | `string` | - | Username for API authentication |
| **Dispatcharr Admin Password** | `password` | - | Password for API authentication |
| **Profile Name** | `string` | - | Name of an existing Channel Profile to process (e.g., "Primary", "Sports") |
| **Channel Groups** | `string` | - | Comma-separated group names to process, or leave empty for all groups |
| **Ignore Tags** | `string` | - | Comma-separated tags to ignore during matching (e.g., `4K, [4K], [Dead]`) |
| **Ignore Quality Tags** | `boolean` | True | Remove quality-related patterns like [4K], HD, (SD) during matching |
| **Ignore Regional Tags** | `boolean` | True | Remove regional indicators like "East" during matching |
| **Ignore Geographic Tags** | `boolean` | True | Remove geographic prefixes like US:, CA:, UK: during matching |
| **Ignore Miscellaneous Tags** | `boolean` | True | Remove miscellaneous tags like (CX), (Backup) during matching |
| **Visible Channel Limit** | `number` | 1 | Number of channels per matching group that will be visible and have streams added |
| **Enable [Database]** *(v0.6.0)* | `boolean` | US: True, Others: False | Enable or disable specific channel databases for matching |
## Usage Guide