-
Notifications
You must be signed in to change notification settings - Fork 0
Schedules
StreamTV now supports schedule YAML files that define complex playback sequences with pre-roll, mid-roll, post-roll commercials, custom titles, and duration-based fillers.
Schedule files are located in the schedules/ directory and follow a specific YAML format. When a channel has a matching schedule file (e.g., mn-olympics-1980.yml for channel "1980"), StreamTV will automatically use it to generate the playback sequence instead of simple playlists.
Schedule files contain three main sections:
Maps content keys to collections and their playback order:
content:
- key: 1980_opening
collection: Retro Olympics - 1980 Opening Ceremony (ABC)
order: chronological
- key: mn80_pre_roll
collection: MN 1980 Pre-Roll IDs (TC Media Now)
order: shuffle-
key: Unique identifier for this content -
collection: Name of the collection/playlist in the database -
order:chronologicalorshuffle
Defines reusable sequences of content:
sequence:
- key: mn80-pre-roll
items:
- duration: "00:01:00"
content: mn80_pre_roll
filler_kind: Commercial
trim: true
discard_attempts: 2
- key: mn80-channel
items:
- pre_roll: true
sequence: mn80-pre-roll
- all: 1980_opening
custom_title: "Lake Placid Opening Ceremony (ABC)"
- pre_roll: falseSequence items can be:
-
Duration-based fillers:
duration+contentkey -
Content blocks:
all+ content key (plays all items from collection) -
Sequence references:
sequencekey (references another sequence) - Pre-roll/Mid-roll/Post-roll flags: Control when commercial sequences are inserted
Defines which sequence to play and whether to repeat:
playout:
- sequence: mn80-channel
- repeat: trueFirst, import media items and create collections:
# Import media items from data/retro_olympics_streams.yaml
python3 scripts/import_olympics_data.py
# Import collections (groups media items by collection name)
python3 scripts/import_collections.pyPlace schedule YAML files in the schedules/ directory. The file name should match the channel number:
- Channel "1980" →
schedules/mn-olympics-1980.yml - Channel "1984" →
schedules/mn-olympics-1984.yml - Channel "1988" →
schedules/mn-olympics-1988.yml
StreamTV automatically detects and loads schedule files when generating HLS streams or EPG data. No additional configuration is needed.
Schedule files support inserting commercial sequences before, during, and after content:
- pre_roll: true
sequence: mn80-pre-roll
- all: 1980_opening
custom_title: "Lake Placid Opening Ceremony (ABC)"
- pre_roll: falseWhen pre_roll: true is set, items from the referenced sequence are inserted before the next content block. When pre_roll: false, pre-roll insertion stops.
Override media item titles in EPG and playlists:
- all: 1980_opening
custom_title: "Lake Placid Opening Ceremony (ABC)"Fill a specific duration with items from a collection:
- duration: "00:08:00"
content: ads_1980_wjcl
filler_kind: Commercial
trim: true
discard_attempts: 6The system will select items from the collection to fill approximately 8 minutes, with up to 6 discard attempts if items don't fit.
Enable infinite looping:
playout:
- sequence: mn80-channel
- repeat: trueWhen repeat: true, the sequence will loop indefinitely.
-
HLS Stream Generation (
/iptv/channel/{channel_number}.m3u8):- Checks for schedule file matching channel number
- Parses YAML and generates playlist from sequence
- Falls back to database playlists if no schedule file found
-
EPG Generation (
/iptv/xmltv.xml):- Uses schedule to generate program listings
- Applies custom titles
- Calculates start/end times for each program
-
Collection Mapping:
- Schedule files reference collections by name
- Collections are created from
data/retro_olympics_streams.yaml - Media items are grouped by the
collectionfield
- Check that the schedule file exists in
schedules/directory - Verify the file name matches the channel number pattern
- Check server logs for parsing errors
- Run
python3 scripts/import_collections.pyto create collections - Verify collection names in schedule file match database collection names
- Check that media items have been imported first
- Ensure collections contain media items
- Verify content keys in schedule file match keys in
contentsection - Check that sequence references are correct
See schedules/mn-olympics-1980.yml for a complete example with:
- Multiple content definitions
- Pre-roll, mid-roll, post-roll sequences
- Custom titles
- Duration-based fillers
- Repeat logic