Cascading Rewrite Rules
Pluvira provides a flexible, multi-tiered cascading metadata engine allowing you to normalize channel titles, sanitize resolution tags, map EPG identifiers, and assign channel categories dynamically.
1. Cascading Execution Pipeline
Metadata transformations execute sequentially across three hierarchical tiers:
[Raw Ingested Channel] │ ▼[Global Rewrite Rules] ──► Applied uniformly across all playlists │ ▼[Source-Level Rewrites] ──► Applied to channels from a specific M3U feed │ ▼[Individual Channel Rules] ──► Applied specifically to an individual stream URL │ ▼[Final Processed Channel]Immutable Key Identity
To ensure rules execute reliably regardless of prior substitutions, each channel maintains an immutable original_url attribute as its permanent identity anchor.
2. Rule Execution Modes
| Mode | Syntax / Behavior | Best Suited For |
|---|---|---|
replace | Replaces the target attribute completely with the specified string. | Direct channel renaming or group assignment. |
regex | Matches regular expression patterns and supports capture groups ($1, $2). | Stripping complex broadcast markers or quality tags. |
wildcard | Glob-style pattern matching using * (any characters) and ? (single character). | Batch matching similar channel variants. |
text | Standard substring search and replace. | Simple spelling corrections or acronym expansion. |
3. Supported Attributes
Rules can target any of the following channel attributes:
name: Channel display label in the WebUI and dynamic exports.group: Group or genre category (e.g., News, Cinema, Documentary).tvg_id: XMLTV guide identifier used for schedule matching.logo: Image URL for channel artwork.
4. Practical Anonymous Examples
Example 1: Stripping Resolution Tags via Regex
Removes trailing resolution labels such as 1080p, 720p, or [HD]:
- Target Field:
name - Mode:
regex - Pattern:
\s*\[?(1080p|720p|HD|FHD)\]?\s* - Replacement:
""(empty) - Sample Input:
Channel Alpha [1080p] - Result:
Channel Alpha
Example 2: Batch Group Assignment via Wildcard
Assigns all news-related channels into a unified group:
- Target Field:
group - Mode:
wildcard - Pattern:
*News* - Replacement:
Information & News
Example 3: Uniform EPG Mapping via Replace
Assigns a standardized EPG identifier to a designated stream:
- Target Field:
tvg_id - Mode:
replace - Pattern:
channel-alpha-source1 - Replacement:
channel-alpha.guide
5. Dynamic Export Integration
Rewrite rules are applied on-the-fly when serving dynamic M3U (/export/m3u) and XMLTV (/export/xml) playlists:
- Changes take effect immediately without requiring full playlist re-downloads.
- Original upstream stream URLs and source references are preserved intact in the underlying SQLite database.