th0ma7 / tv_grab_zap2epg

Fork from original edit4ever/script.module.zap2epg python3 branch with focus only on tvheadend server.
GNU General Public License v3.0
4 stars 1 forks source link

tv_grab_zap2epg - tvheadend XMLTV Grabber

North America (zap2epg using tvlistings.zap2it.com)

tv_grab_zap2epg will generate an xmltv.xml file for Canada/USA TV lineups by fetching channel list from tvheadend and downloading relevant entries from tvlistings.zap2it.com.

zap2epg was originally designed to be easily setup in Kodi for use as a grabber for tvheadend. This is a fork of the original code from edit4ever Python3 branch of script.module.zap2epg based on my PR https://github.com/edit4ever/script.module.zap2epg/pull/37 (much thanks for your great original work @edit4ever !!!)

It includes the ability to automatically fetch your channel list from TVH to reduce the amount of data downloaded and speed up the grab. It has an option for downloading extra detail information for programs. (Note: this option will generate an extra http request per episode) It also has an option to append the extra detail information to the description (plot) field, which makes displaying this information in the Kodi EPG easier on many skins.

Note that zap2epg is a proof of concept and is for personal experimentation only. It is not meant to be used in a commercial product and its use is your own responsibiility.

tv_grab_zap2epg capabilities

zap2epg TV guide grabber script provides baseline capabilities (ref: http://wiki.xmltv.org/index.php/XmltvCapabilities):

Configuration options (zap2epg.xml)

TVheadEnd (TVH) auto-channel fetching

This feature is enabled by default using anonymous access. You must have a * user defined in TVH with minimally:

Using the following configuration:

INSTALLATION: Synology DSM6/DSM7 TVH server:

Already included in the SynoCommunity tvheadend package for DSM6-7 since v4.3.20210612-29

DSM7 file structure:

/var/packages/tvheadend/target/bin
└── tv_grab_zap2epg
/var/packages/tvheadend/var/epggrab
├── cache
│   ├── *.json
│   └── xmltv.xml
├── conf
│   └── zap2epg.xml
└── log 
    └── zap2epg.log

DSM6 file structure:

/var/packages/tvheadend/target/bin
└── tv_grab_zap2epg
/var/packages/tvheadend/target/var/epggrab
├── cache
│   ├── *.json
│   └── xmltv.xml
├── conf
│   └── zap2epg.xml
└── log 
    └── zap2epg.log

Manual Installation

  1. Install tv_grab_zap2epg script addon in /usr/local/bin or /var/packages/tvheadend/target/bin
  2. Install zap2epg.xml configuration file under tvheadend epggrab/conf directory such as ..var/epggrab/conf
  3. Manually adjust zap2epg.xml configuration file as needed or use capabilities (see description below)

Testing

In order to test tv_grab_zap2epg EPG grabber under Synology DSM:

$ sudo su -s /bin/bash sc-tvheadend -c '~/bin/tv_grab_zap2epg --capabilities'
baseline
$ sudo su -s /bin/bash sc-tvheadend -c '~/bin/tv_grab_zap2epg --days 1 --postal J3B1M4 --quiet'
$ ls -la ~sc-tvheadend/var/epggrab/cache/xmltv.xml
-rw-rw-rw- 1 sc-tvheadend tvheadend 16320858 Jun 13 07:43 /var/packages/tvheadend/target/var/epggrab/cache/xmltv.xml

INSTALLATION: Docker tvheadend setup:

Installation is somewhat different where it uses the hts user account to handle the directory structure such as:

/usr/bin
└── tv_grab_zap2epg
/home/hts/epggrab
├── cache
│   ├── *.json
│   └── xmltv.xml
├── conf
│   └── zap2epg.xml
└── log 
    └── zap2epg.log

Manual Installation

Create the directory structure and adjust permissions:

# mkdir -p /home/hts/zap2epg/conf
# mkdir -p /home/hts/zap2epg/log
# mkdir -p /home/hts/zap2epg/cache
# chown -R hts:hts /home/hts/zap2epg
# chmod -R 0755 /home/hts/zap2epg

Copy the configuration and adjust permissions:

# cp zap2epg.xml /home/hts/zap2epg/conf
# chown hts:hts /home/hts/zap2epg/conf/zap2epg.xml
# chmod 644 /home/hts/zap2epg/conf/zap2epg.xml

Copy the script to /usr/bin and adjust permissions:

# tv_grab_zap2epg /usr/local/bin
# chmod 755 /usr/local/bin/tv_grab_zap2epg