> For the complete documentation index, see [llms.txt](https://docs.cstplus.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cstplus.org/documentation/feature-reference/epg.md).

# EPG

Every channel in CST+ generates an EPG (Electronic Programme Guide) automatically. Viewers see programme titles, times, and descriptions in their IPTV app without any manual work on your part.

***

### How EPG is generated

{% tabs %}
{% tab title="Loop mode" %}
In loop mode, CST+ projects the loop forward in time from the moment the channel started. Each clip gets an EPG entry with its filename as the title and a start time calculated from the playback position.

The EPG window covers the number of days set in **Settings > Streaming > EPG days** (default: 7 days ahead).
{% endtab %}

{% tab title="Schedule mode" %}
In schedule mode, the EPG is anchored to **local midnight** using the server timezone. Every block in your 24-hour schedule gets a fixed clock time that repeats the same every day.

This is what viewers see in their app: "Movie starts at 20:00" today, tomorrow, and every day after. Filler blocks are collapsed into a single generic entry between named programmes.
{% endtab %}
{% endtabs %}

***

### Accessing the EPG

The XMLTV guide is served at:

```
http://YOUR_SERVER:8080/xmltv.php?username=USER&password=PASS
```

This URL is already embedded in every M3U playlist via the `url-tvg` tag, so apps that support it load the guide automatically.

***

### Programme metadata

By default, EPG entries use the filename as the title with no description or poster. To enrich your EPG with real metadata:

#### TMDB integration

Go to **Settings > API** and enter your TMDB API key. Then on any channel page, open the **Programme metadata** editor and click **Search TMDB** next to any clip.

CST+ fetches the title, description, poster image, and age rating from TMDB and stores them locally. Click **Apply to all** to apply a single match to every instance of that clip across all channels.

{% hint style="info" %}
TMDB lookups are cached locally. Once a clip is matched, the metadata is stored in the database and no further TMDB requests are needed for that clip, even after re-renders.
{% endhint %}

#### Manual metadata

On the channel page, open the **Programme metadata** editor and fill in the fields manually for any clip: title, description, poster URL, age rating, genre, year.

Manually entered metadata takes precedence over TMDB data.

***

### EPG export

You can export the EPG for any channel in three formats. On the channel page, click **Export EPG**:

{% tabs %}
{% tab title="XMLTV (XML)" %}
Standard XMLTV format. Import into any EPG editor or aggregator that accepts XMLTV files.

```
GET /api/channels/{id}/epg/export?format=xml
```

{% endtab %}

{% tab title="CSV" %}
One row per programme with start time, end time, title, and description.

```
GET /api/channels/{id}/epg/export?format=csv
```

{% endtab %}

{% tab title="Plain text" %}
Simple list format: `HH:MM - Title` per line.

```
GET /api/channels/{id}/epg/export?format=txt
```

{% endtab %}
{% endtabs %}

{% hint style="success" %}
Use the XMLTV export to submit your EPG to aggregators that require a static guide file rather than a live XMLTV URL.
{% endhint %}

***

### EPG in IPTV apps

| App               | How it loads the EPG                                    |
| ----------------- | ------------------------------------------------------- |
| Tivimate          | Reads `url-tvg` from the M3U playlist automatically     |
| IPTV Smarters     | Reads `url-tvg` from the M3U playlist automatically     |
| GSE Smart IPTV    | Reads `url-tvg` from the M3U playlist automatically     |
| Kodi + PVR Simple | Enter the XMLTV URL manually in the PVR plugin settings |

***

### Troubleshooting EPG

**EPG is blank in the app** Most apps load the EPG URL from the M3U `url-tvg` tag. Use the M3U URL from the Lines page rather than constructing it manually.

**EPG shows wrong times** The timezone is set in **Settings > General > Server timezone**. Change it and restart the control plane:

```bash
systemctl restart cstplus-control
```

**EPG shows filenames instead of titles** No TMDB key is set, or the clips have not been matched yet. Go to **Settings > API**, add your TMDB key, then use the programme metadata editor on each channel to match clips.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.cstplus.org/documentation/feature-reference/epg.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
