Skip to content

Sort Playlist Rule

The sort rule controls the ordering of channels in a playlist, optionally grouping by any channel field.

YAML Structure

sort:
  selector: ""
  order: []
  group_by:
    selector: ""
    order: []

Fields

Field Type Required Description
selector Selector No Property to use for sorting (attribute/tag/etc), default is name
order []regex No Custom order of channels, regex patterns
group_by GroupByRule No Group before sorting

GroupByRule

Field Type Required Description
selector Selector Yes How to group (attribute/tag)
order []regex No Custom order of groups, regex patterns

How It Works

  1. If group_by is set, channels are grouped by group_by.selector.
  2. Channel or group order is determined by the corresponding order arrays (if present).
  3. Within each group (or globally), regex order is applied in order. Unmatched go at the end.
  4. Channels within the same priority are alphabetically sorted by name/selector value.

Examples

Simple alphabetical sort:

playlist_rules:
  - sort: {}

Sort by attribute, move News and Children groups to the top:

playlist_rules:
  - sort:
      selector: attr/tvg-name
      group_by:
        selector: tag/EXTGRP
        order: ["News", "Children", ""]