Skip to content

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

ModeSyntax / BehaviorBest Suited For
replaceReplaces the target attribute completely with the specified string.Direct channel renaming or group assignment.
regexMatches regular expression patterns and supports capture groups ($1, $2).Stripping complex broadcast markers or quality tags.
wildcardGlob-style pattern matching using * (any characters) and ? (single character).Batch matching similar channel variants.
textStandard 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.