TS IPTV

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 / attributeRequiredMeaning
idyesChannel id. The playlist uses exactly this value in tvg-id.
<display-name lang="…">at least 1Channel name.
<icon src="…"/>noChannel logo.
<url>noThe channel's website.

<programme>

Element / attributeRequiredMeaning
channelyesMust equal a <channel id>.
startyesStart time (see the time format below).
stopshould be presentStop time. TS IPTV needs it, so always write stop.
<title lang="…">at least 1Programme title.
<sub-title>noEpisode title.
<desc lang="…">noDescription. The only element where line breaks are allowed.
<category lang="…">no, repeatableGenre.
<icon src="…"/>noProgramme artwork.
<credits>noDirector (<director>), actors (<actor>) and so on.
<episode-num system="…">noSeason and episode number (see below).
<rating system="…"><value>noAge rating, for example system="MPAA", PG.
<star-rating><value>noScore, 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

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>
  1. Two <channel> elements come before every programme, each with one <display-name>.
  2. Two dated programmes (the evening of 31 December 2025, UTC) show the optional elements: sub-title, category, episode-num in both systems, and rating.
  3. “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:

  1. Copy the example above into a plain-text editor (Notepad, TextEdit in plain text mode, VS Code).
  2. Add one <channel id="…"> per channel, with an id equal to the playlist's tvg-id.
  3. Add <programme> elements after all the <channel> elements, always with start, stop and a time-zone offset.
  4. Write & as &amp; and < as &lt; in titles and descriptions.
  5. Save as UTF-8 with the extension .xml.
  6. 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.

Add it in TS IPTV

  1. 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: the epgUrl field).
  2. Add that playlist in TS IPTV (or refresh it if it is already there). The guide is downloaded with it.
  3. 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

MistakeSymptomFix
No time-zone offset on start/stopGuide shifted by some hoursAlways 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-idEmpty guideUse the same string in all three places.
& not written as &amp;XML error, the whole guide is lostWrite &amp;.
<programme> before <channel>Some readers skip the channelsPut all <channel> elements first (DTD order).
Overlapping or duplicate programmesFlickering or repeated rowsMake 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

FeatureStatus
XMLTV .xml and gzip .xml.gzSupported on every platform
XZ .xml.xzNot supported
Any time-zone offset in start/stopSupported
Several guides in x-tvg-url (up to 5), merged without duplicatesSupported
tvg-shift per channel or for the whole playlistSupported
Shows title, description, category, artwork, director and actorsSupported
sub-title, episode-num, rating, star-ratingAccepted, not shown yet
A separate field for a guide URLNot yet Use x-tvg-url.