Overview
The EPG system uses Scriban templates to generate XMLTV data. Each media type (movies, episodes, music videos, etc.) has its own template that controls what appears in the guide.Template Locations
Default templates (included with ErsatzTV):Guide Mode
ErsatzTV supports two guide modes that control EPG visibility:- Normal
- Filler
All scheduled content appears in the EPG guide.Use cases:
- Standard TV channels
- When viewers should see all content
Setting Guide Mode
In Classic Schedules:- Edit schedule item
- Set Guide Mode to Normal or Filler
- Filler items won’t appear in EPG but will still play
Movie Template
Default Movie Template
movie.sbntxt
Available Movie Variables
| Variable | Type | Description |
|---|---|---|
programme_start | string | Start time (XMLTV format) |
programme_stop | string | Stop time (XMLTV format) |
channel_id | string | Channel identifier |
channel_id_legacy | string | Legacy channel ID |
channel_number | string | Channel number |
has_custom_title | bool | True if custom title set |
custom_title | string | Custom EPG title |
movie_title | string | Movie title |
movie_has_plot | bool | True if plot exists |
movie_plot | string | Movie plot/description |
movie_has_year | bool | True if year exists |
movie_year | int | Release year |
movie_genres | array | List of genres |
movie_has_artwork | bool | True if artwork exists |
movie_artwork_url | string | Poster URL |
movie_has_content_rating | bool | True if rating exists |
movie_content_rating | string | Content rating |
movie_guids | array | External IDs (IMDb, TMDb, etc.) |
Episode Template
Default Episode Template
episode.sbntxt
Available Episode Variables
| Variable | Type | Description |
|---|---|---|
programme_start | string | Start time |
programme_stop | string | Stop time |
channel_id | string | Channel identifier |
has_custom_title | bool | Custom title flag |
custom_title | string | Custom EPG title |
show_title | string | TV show title |
episode_has_title | bool | Episode title exists |
episode_title | string | Episode title |
episode_has_plot | bool | Episode plot exists |
episode_plot | string | Episode description |
show_has_year | bool | Show year exists |
show_year | int | Show release year |
show_genres | array | Show genres |
episode_has_artwork | bool | Episode poster exists |
episode_artwork_url | string | Episode poster URL |
episode_has_thumbnail | bool | Episode thumbnail exists |
episode_thumbnail_url | string | Episode still URL |
season_number | int | Season number |
episode_number | int | Episode number |
show_has_content_rating | bool | Show rating exists |
show_content_rating | string | Show content rating |
show_guids | array | Show external IDs |
episode_guids | array | Episode external IDs |
Music Video Template
Available Music Video Variables
| Variable | Type | Description |
|---|---|---|
artist_title | string | Artist name |
music_video_title | string | Song/video title |
music_video_has_plot | bool | Description exists |
music_video_plot | string | Video description |
music_video_has_year | bool | Release year exists |
music_video_year | int | Release year |
music_video_genres | array | Video genres |
artist_genres | array | Artist genres |
music_video_has_artwork | bool | Artwork exists |
music_video_artwork_url | string | Artwork URL |
music_video_has_track | bool | Track number exists |
music_video_track | int | Track number |
music_video_has_album | bool | Album exists |
music_video_album | string | Album name |
music_video_has_release_date | bool | Release date exists |
music_video_release_date | string | Release date |
music_video_all_artists | array | All artists (featuring, etc.) |
music_video_studios | array | Studios/labels |
music_video_directors | array | Video directors |
Custom EPG Data
You can expose custom data to the graphics engine using theetv: XML namespace:
All
etv: nodes are:- Passed to the graphics engine as EPG template data
- Stripped from XMLTV when requested by clients
- Available as strings (not numbers) in graphics templates
XMLTV Settings
Configure EPG behavior in Settings > General:XMLTV Days to Build
Controls how many days of EPG data to generate.- Must be ≤ Playout Days To Build
- Smaller values improve performance
- Larger values provide more guide data
XMLTV Time Zone
Controls time zone in generated XMLTV:- Local
- UTC
Uses local server time zone (from TZ environment variable)
XMLTV Block Behavior
Controls how block schedules appear in EPG:- Split Time Evenly
- Use Actual Times
Default behavior. Block time is split evenly among all visible items.Example:
- 1-hour block with 3 visible items
- Each item shows as 20 minutes in EPG
Instance ID
Disambiguate EPG data when running multiple ErsatzTV instances:Accessing XMLTV Data
URLs
Without authentication:M3U Playlist
The channel playlist already includes the XMLTV URL:Advanced Template Examples
Add Director to Movie EPG
Check default templates for available variables like
movie_directors, movie_actors, etc. These may vary by media type.Conditional Categories
Multiple Images
Scriban Functions
Useful Scriban functions for templates:String Functions
Math Functions
Array Functions
Troubleshooting
Template Syntax Errors
Check ErsatzTV logs for template parsing errors:- Missing
{{ end }}tags - Unclosed
{{ if }}blocks - Typos in variable names
EPG Not Updating
- Trigger manual rebuild: Edit and save any schedule
- Check XMLTV URL: Visit
http://localhost:8409/iptv/xmltv.xmldirectly - Clear IPTV client cache: Some clients cache EPG data
Missing Program Information
- Verify metadata: Check if source media has the data (NFO files, media server)
- Deep scan library: Trigger a deep scan to update metadata
- Check template variables: Use
{{ if variable_exists }}guards
500 Errors Serving XMLTV
Fixed in v26.2.0+. If experiencing issues:- Update to latest ErsatzTV version
- Check for concurrent XMLTV reads/writes in logs
- Ensure sufficient disk space in
/config
Next Steps
Graphics Engine
Use EPG data in custom graphics overlays
Channel Configuration
Configure channel settings
Classic Schedules
Set guide mode and custom titles
Scriban Documentation
Learn more about Scriban template syntax
