This script grabs EPG data from a Sundtek media server, converts it to XMLTV data and upload the XMLTV data file to a ftp server (optional). The XMLTV data file can be used e.g. by the Kodi's Simple IPTV addon.
sudo git clone https://github.com/jazzpi/sundtek-to-xmltv.git /opt/sundtek-to-xmltv
sudo chown -R user:user /opt/sundtek-to-xmltv
pip3 install requests
pip3 install pytz
sudo cp /opt/sundtek-to-xmltv/sundtek_xmltv.service /etc/systemd/system/
sudo chmod 644 /etc/systemd/system/sundtek_xmltv.service
sudo systemctl daemon-reload
sudo systemctl enable --now sundtek_xmltv.service
Edit config.json and replace the content of the fields.
Replace USERNAME
in sundtek_xmltv.service with the username of the local user.
If SERVER
is not empty and ENABLED
is set to true, the upload will be executed after fetching data.
FETCH
SERVER
IP and PORT of sundtek serverDAYS
How many days to fetch (including today)?
Set to 0 to only fetch data fromnow
. (now
contains the current and the next 6 shows.)
Beware that a couple days can already take a couple minutes, even with just 20 channels.CHANNEL_GROUPS
Which channel groups should be fetched e.g.["SD", "HD"]
?
If the array is empty, each channel whould be fetched.OUTPUT_FILE_PATH
Where to save the output (relative save filepath e.g.../../home/shares/tv/epg.xml
)?DEBUG
enable/disable DEBUG modeDEBUG_CHANNEL_PREFIX
parse only channels with the given prefix
FTP_UPLOAD
ENABLED
enable/disable uploadFILE_NAME
name of the file on the the ServerSERVER
hostname of the ServerUSERNAME
username (for authentification)PASSWORD
password (for authentification)