Howto Setup EPG and XMLTV
EPG
A functional and rich electronic program guide (EPG) is cruical to the TV experience. If you plan to offer recording and timeshift to your end-users it becomes even more important. There are two ways the SnapTV system can harvest EPG data; from DVB streams or from XMLTV formattet xml files. This guide will show you how to harvest EPG data from XMLTV.
XMLTV and grabbers
There are several commercial players offering EPG data in the XMLTV format. This guide will use xmltv grabbers for non commercial use as an example.
Install a grabber for your region on your SnapTV server
sudo apt-get install tv_grab_no
Configure the grabber
tv_grab_no
Follow the instructions and chose your channels.
tv_grab_no > ~/epg.xml
Upload the EPG data
- Open the SnapTV server's web interface by entering the IP in a browser.
- Goto Content Management > EPG data
- Upload the XMLTV file (epg.xml)
Map EPG IDs
The TV channels on the SnapTV system have an EPG ID per channel. Normally the EPG is harvested from a DVB stream and this ID has the format [network id].[transponder id].[service id].dvb.snap.tv. If you want to use XMLTV as the EPG source you will need to update the EPG ID manually per TV channel.
- On the server that is streaming the TV channeøs open the page "Live Inputs" -> "TV Channels".
- Click the "Edit" link on the TV channel you want to chan
- Change the EPG ID so it matches the channel id in your xml file and postfix the id with "xmltv.snap.tv" (e.g. "cnn.com.xmltv.snap.tv")
- repeat for all channels you want xmltv epg for
TIP: If you are changing alot of settings you might want to consider editing the configuration xml file instead of using the web forms. Open the page "System Configuration" > "Configuration Profiles" to access the configuration file. Always take a backup of the configuration file before changing it manually.
Test if you have EPG
Make sure one of your servers are running the EPG service. On this server you sould be able to view EPG data if any
Also make sure EPG is available on your set top box. The set top box GUI can also be opened in a normal browser and has the address http://[Portal server IP]/up
If you dont see any EPG make sure the time on the server and the set top box is synchronised and that your EPG data covers the current time.
Automate the harvesting
You can automate the EPG updates by using the build in scheduler in Linux; cron.
This example creates a simple script for updating EPG.
Create a script that will be run on a daily basis:
sudo nano /etc/cron/cron.daily.d/epg-grab.sh
Paste the following into the script
#!bin/sh
tv_grab_no > ~/epg.xml
snaptv-epg-xmltv-import ~/epg.xml
Modify the script to your grabber and save it.
A note about grabbers
The grabbers mentioned in this guide are only included for the sake of examples and should only be used for testing. Some EPG grabbers may unlawfully collect licensed data and may not be allowed for commercial use. Make sure you have the rights to download and distribute the EPG data. There are several commercial operators that offers EPG data for a fee.