EPG Import Format
Download as PDF
The SmartTUBE SDP supports two EPG import formats:
- XMLTV
XMLTV is a popular modern standard for describing TV listings. One file contains EPG for all channels. You can find a description and example of this format on the official XMLTV Wiki. - SmartLabs EPG XML
Simplified XML format developed by SmartLabs. One file contains EPG for one channel. All subsequent chapters of this section describe this format. You can use this for XML validation.
Regardless of your choice only HTTP(S) is supported as the EPG delivery protocol.
Program Identification
The TV programs are identified and matched by <id> field. Programs with unknown IDs are treated as new. The action which will be performed to the TV show is specified by the following logic:
- If the <status> field have the following values:
- delete — the TV show will be unpublished. It is enough to specify only <id>, <status> and <channel_id> for this action (in this case, the other fields will be ignored, and no changes will be made to these fields);
- update — the TV show attributes will be updated with metadata from the import file.
- If the <status> field is not specified or have another value:
- if the TV show does not exist — a new TV show with metadata from the import file will be created;
- if the TV show exists and <change_date> is equal to its previous value — no actions will be performed (the TV show will be ignored).
- if the TV show exists and <change_date> is not equal to its previous value — TV show attributes will be updated with the specified data, including saving current <change_date> value.
Genres, Categories and Countries Identification
- The content Genres, Categories and Countries are determined by the <dictionaries> section, as shown below (see “Example of SmartLabs EPG XML Format”). Once imported, they are stored in the corresponding dictionaries of the SmartTUBE SDP.
- Multilanguage values are supported.
- If the <event> section contains unknown Genres, Categories or Countries, the SmartTUBE SDP creates them anyway. In such cases they are created only for the default language (determined by the default-profile-language parameter in the SmartTUBE SDP configuration file system.conf).
Image Identification
The identification of image type (<image> tag) is performed as follows:
- By the header Content-Type: image/jpeg or Content-Type: image/png;
- If the header was not recognized, by the file extension in the URL (e.g. http://image.storage/imagename.png);
- If the file extension was not recognized, the error is logged.
Failure Notifications
In order to control the EPG import process result, you can configure email alerts in the SmartTUBE Admin Console > Administration > Email Alerts. You can also find useful information in the smarttube service log.
You can also call the import externally and get back results of such process the following way:
$ curl –H “Content-Type: application/json” -X POST –d ‘{“method”: “epgimport#doheapimport”, “params”: {“epg-import.url”: “http://epg_source_host_ip:port/epg.xml”}, “id”: 1 }’ http://smarttube_sdp_ip:port/sdpapibd // Return Example { |
Recommendations for Optimizing EPG Import
- To reduce the load on the server and speed up the EPG data processing, we recommend you to make the daily import affect only 2-3 days, and re-import all programs and create new ones only once a week.
- To ensure that EPG is displayed correctly in the SmartTUBE apps and that nPVR services work correctly, it is recommended to maintain a database of program IDs and, before importing, only check whether programs have been removed from the EPG. This way you can <update> all programs every time, and <delete> only if it is really necessary.
- The | and * characters should be avoided in the import file, since they can be used as internal string separators. As a result, imported strings may not be displayed on end-user devices. We recommend replacing the separators as follows:
* -> “
| -> /
Maximum Field Length
Please see the table below for the maximum field lengths in the SmartLabs EPG XML format:
Name of Field |
Default Max Length, symbols |
title |
300 |
details/subtitle |
300 |
details/description |
4000 |
dictionaries/genres/genre/id |
300 |
dictionaries/genres/genre/name |
300 |
dictionaries/categories/category/id |
300 |
dictionaries/categories/category/name |
300 |
dictionaries/countries/country/id |
300 |
dictionaries/countries/country/name |
300 |
details/genre |
300 |
details/category |
300 |
details/country |
300 |
details/team/member/name |
300 |
details/team/member/role |
300 |
Example of SmartLabs EPG XML Format
<?xml version=“1.0” encoding=“UTF-8”?> |
Change Log
SmartTUBE 8.4
- Support for the <public_npvr> tag added for the SmartLabs EPG XML format added
SmartTUBE 7.10
- Support for the <title_original> tag added for the SmartLabs EPG XML format added