XMLTV programme guides
XMLTV is the most common XML format for electronic programme guides (EPG): it lists channels and each channel's programmes, with start and stop times, titles and descriptions.
TS IPTV includes no channels and no guides. It reads only the playlists and guides you add.
What XMLTV is
XMLTV comes from an open-source project of TV listings tools; the file structure is defined in its official DTD. Today almost every IPTV player reads XMLTV. A playlist says which channels exist; an XMLTV file says what is on them now and next.
Syntax
The root element is <tv>. Inside it, all <channel> elements come first, then the <programme> elements:
<tv>
<channel id="…"> (zero or more)
<display-name>…</display-name>
<icon src="…"/>
</channel>
<programme start="…" stop="…" channel="…"> (zero or more)
<title>…</title>
<sub-title>…</sub-title>
<desc>…</desc>
<category>…</category>
<episode-num system="…">…</episode-num>
<rating system="…"><value>…</value></rating>
</programme>
</tv>
<tv>
The root element. Optional attributes: date, generator-info-name, generator-info-url, source-info-name, source-info-url, source-data-url.
<channel>
| Element / attribute | Required | Meaning |
|---|---|---|
id | yes | Channel id. The playlist uses exactly this value in tvg-id. |
<display-name lang="…"> | at least 1 | Channel name. |
<icon src="…"/> | no | Channel logo. |
<url> | no | The channel's website. |
<programme>
| Element / attribute | Required | Meaning |
|---|---|---|
channel | yes | Must equal a <channel id>. |
start | yes | Start time (see the time format below). |
stop | should be present | Stop time. TS IPTV needs it, so always write stop. |
<title lang="…"> | at least 1 | Programme title. |
<sub-title> | no | Episode title. |
<desc lang="…"> | no | Description. The only element where line breaks are allowed. |
<category lang="…"> | no, repeatable | Genre. |
<icon src="…"/> | no | Programme artwork. |
<credits> | no | Director (<director>), actors (<actor>) and so on. |
<episode-num system="…"> | no | Season and episode number (see below). |
<rating system="…"><value> | no | Age rating, for example system="MPAA", PG. |
<star-rating><value> | no | Score, for example 7 / 10. |
Time format
start and stop are YYYYMMDDhhmmss followed by a time-zone offset: 20260927183000 +0700 is 18:30:00 on 27 September 2026 in UTC+7. The DTD says that a time without an offset is UTC, but TS IPTV currently reads such times in the device's time zone. So always write the offset. Intervals are half-open: a programme starts at start and ends just before stop, so one programme's stop should equal the next one's start.
Episode numbers: episode-num
system="xmltv_ns":season.episode.part, counted from zero.2.4.means season 3, episode 5. Each part may beX/Y:0.11/12.0/2is season 1, episode 12 of 12, part 1 of 2. Unknown parts are left empty.system="onscreen": free text as shown on screen, for exampleS03E05. This is the default whensystemis omitted.
How a guide links to a playlist
- The URL: an M3U playlist points to its guide with
#EXTM3U x-tvg-url="https://…/guide.xml"(or the olderurl-tvg); a JSON playlist uses theepgUrlfield. Several guides may be separated by commas: TS IPTV downloads up to 5 and merges their programmes, dropping duplicates. - The channel id: the playlist channel
tvg-id="ExampleNews.us"gets the programmes of<channel id="ExampleNews.us">. Copy the id exactly. If no programme uses it, TS IPTV tries the id ignoring case and spaces, then thetvg-nameand the channel name against<display-name>(case, accents and spaces ignored). - Time shift: if the guide is off by some hours, add
tvg-shift="+1"(in hours) to the channel, or to the#EXTM3Uline for every channel.
Complete example
This is the guide that the example M3U playlist points to. It has two channels: HlsTest.example and ExampleNews.us.
<?xml version="1.0" encoding="UTF-8"?>
<tv generator-info-name="TS IPTV examples">
<channel id="HlsTest.example">
<display-name lang="en">HLS Test Channel</display-name>
</channel>
<channel id="ExampleNews.us">
<display-name lang="en">Example News</display-name>
<icon src="https://example.com/logos/news.png"/>
</channel>
<programme start="20251231220000 +0000" stop="20251231230000 +0000" channel="ExampleNews.us">
<title lang="en">Weekly Magazine</title>
<sub-title lang="en">Harvest Season</sub-title>
<desc lang="en">A dated example programme with an episode number and a rating.</desc>
<category lang="en">Documentary</category>
<episode-num system="xmltv_ns">2.4.</episode-num>
<episode-num system="onscreen">S03E05</episode-num>
<rating system="MPAA"><value>PG</value></rating>
</programme>
<programme start="20251231230000 +0000" stop="20260101000000 +0000" channel="ExampleNews.us">
<title lang="en">Year in Review</title>
<sub-title lang="en">Part One</sub-title>
<category lang="en">News</category>
<episode-num system="xmltv_ns">0.11/12.0/2</episode-num>
<episode-num system="onscreen">S01E12</episode-num>
<rating system="MPAA"><value>G</value></rating>
</programme>
<programme start="20260101000000 +0000" stop="20301231235959 +0000" channel="HlsTest.example">
<title lang="en">Test pattern</title>
<desc lang="en">One long programme, so the guide always shows something on now.</desc>
<category lang="en">Test</category>
</programme>
<programme start="20260101000000 +0000" stop="20301231235959 +0000" channel="ExampleNews.us">
<title lang="en">Test pattern</title>
<desc lang="en">One long programme, so the guide always shows something on now.</desc>
<category lang="en">Test</category>
</programme>
</tv>
- Two
<channel>elements come before every programme, each with one<display-name>. - Two dated programmes (the evening of 31 December 2025, UTC) show the optional elements:
sub-title,category,episode-numin both systems, andrating. - “Test pattern”: each channel has one programme running from 1 January 2026 to the end of 2030. It is a trick for an example file: whenever you open it, the guide has something “on now”. Real guides use short programmes that follow each other.
Create one by hand
Most people do not write XMLTV by hand: the provider gives a guide URL, or the guide is generated by a grabber tool. For a small personal list, writing one is still easy:
- Copy the example above into a plain-text editor (Notepad, TextEdit in plain text mode, VS Code).
- Add one
<channel id="…">per channel, with an id equal to the playlist'stvg-id. - Add
<programme>elements after all the<channel>elements, always withstart,stopand a time-zone offset. - Write
&as&and<as<in titles and descriptions. - Save as UTF-8 with the extension
.xml. - Compress large guides with gzip to
guide.xml.gz:gzip -k guide.xml(macOS, Linux), or 7-Zip › Add to archive › format gzip (Windows). Do not use.zip: that is a different format.
Host it
Just like an M3U playlist: any HTTPS link that returns the file itself works, for example https://raw.githubusercontent.com/<user>/<repo>/<branch>/guide.xml.gz, https://<user>.github.io/<repo>/guide.xml or https://www.example.com/guide.xml.gz. Google Drive/OneDrive share pages and GitHub blob/ links do not work. Details: hosting an M3U file.
- TS IPTV recognises gzip by its content, so it does not matter whether the server sends
Content-Type: application/gziporContent-Encoding: gzip. - HTTPS is recommended; CORS is not needed for TS IPTV.
- Update the file regularly: a guide that only covers past days has nothing to show.
Add it in TS IPTV
- Add the guide URL to the first line of your M3U playlist:
#EXTM3U x-tvg-url="https://www.example.com/guide.xml.gz"(for JSON: theepgUrlfield). - Add that playlist in TS IPTV (or refresh it if it is already there). The guide is downloaded with it.
- Open a channel's programme list to see what is on now and next. Use Refresh EPG to download the guide again.
TS IPTV has no separate field for a guide URL yet; the guide always comes with a playlist. If your playlist has no x-tvg-url and you cannot edit it where it is hosted, download the file, add the line above, and use Import from file.
Common mistakes
| Mistake | Symptom | Fix |
|---|---|---|
No time-zone offset on start/stop | Guide shifted by some hours | Always add +hhmm. The DTD reads a missing offset as UTC, but TS IPTV currently uses the device's time zone. |
channel does not equal <channel id> or tvg-id | Empty guide | Use the same string in all three places. |
& not written as & | XML error, the whole guide is lost | Write &. |
<programme> before <channel> | Some readers skip the channels | Put all <channel> elements first (DTD order). |
| Overlapping or duplicate programmes | Flickering or repeated rows | Make stop equal the next start. |
A gzip file compressed twice, or a .zip | “Invalid guide” | Compress with gzip exactly once. |
| The guide only covers past days | “No programme guide” | Regenerate it daily. |
What TS IPTV supports
| Feature | Status |
|---|---|
XMLTV .xml and gzip .xml.gz | Supported on every platform |
XZ .xml.xz | Not supported |
Any time-zone offset in start/stop | Supported |
Several guides in x-tvg-url (up to 5), merged without duplicates | Supported |
tvg-shift per channel or for the whole playlist | Supported |
| Shows title, description, category, artwork, director and actors | Supported |
sub-title, episode-num, rating, star-rating | Accepted, not shown yet |
| A separate field for a guide URL | Not yet Use x-tvg-url. |