[Obsolete] How to populate EPG data with zap2xml

The website used to grab the EPG data changed it’s interface in January 2018. These instructions are obsolete. Please see the updated HOW TO guide.

I have successfully populated EPG data using the zap2xml python script provided by edit4ever. The process isn’t difficult but there is nowhere on the internet that lays out the steps. Here is what I did to get it to work. Hopefully, it works for you too.

  1. Install OSMC and tvHeadend. I am on the August 2017 update with tvHeadend version 4.2.2. I had this method previously working on the May 2017 update running tvH version 4.09.

  2. Download the zap2xml zip file from edit4ever’s page on GitHub. Releases · edit4ever/script.module.zap2xml · GitHub

  3. Move the zip file to the device. I am on a Raspberry Pi 3. Install the addon inside KODI from the zip file by selecting addons --> Install from repository --> Install from zip file. Locate the zip file and install the addon. Two dependency files are also installed. Python-Mechanize and Python-BeautifulSoup. Unfortunately, they do not work with OSMC in the way it was intended to. The addon is designed to work with OpenElec devices.

  4. Signup for an account at http://www.zap2it.com. On the website, select the area you want to get EPG data for and select favorites. Some people have had better luck with scraping the website if, after they create their favorites, they move their area (zip code) somewhere else. This apparently removes the channel numbers from the website allowing the script to work better. I haven’t needed to do that last step.

  5. Inside KODI. Select addon --> My addons --> Program add-ons --> zap2xml. Select configure. Enter your username and password in the fields listed. Under options make number of days to cache equal to 1. This simply allows the script to run quicker so you can link the EPG data to the channels sooner. Other options can be configured at a later time after the EPG data is being populated.

  6. Open a SSH shell to your device. If you need, you can also hit escape when the OSMC logo is on the screen to get to a command prompt.

  7. Install XMLTV by typing sudo apt-get install xmltv-util

  8. Install mechanize by typing sudo apt-get install python-mechanize

  9. Install BeautifulSoup by typing sudo apt-get install python-beautifulsoup

  10. In the zip file downloaded from edit4ever navigate to the bin file. Copy the tv_grab_zap2xml file and place it on your device under the /usr/bin folder. Change permissions on the file by typing sudo chmod +x tv_grab_zap2xml

  11. Download the XML file structure from XMLTVFormat - XMLTV and save it as xmltv.xml The script is not smart enough to create this file. I also don’t know if an empty file will work either. Initially I used a windows program zap2xml.exe to create this file for me. I am assuming creating the file structure for the XML file will allow the script to work correctly. I don’t really know.

  12. On your device navigate to /home/osmc/.kodi/userdata/addon_data/script.module.zap2xml Copy the xmltv.xml file to that folder. Change more file permissions sudo chmod 777 xmltv.xml. If the folder is not there, the addon was not installed correctly… but then you also couldn’t complete step 5.

  13. Restart the device or restart tvheadend byexecuting sudo service tvheadend restart

  14. On the tvHeadend website. Make sure the user has expert view selected in their profile. Navigate to Configuration --> Channel / EPG --> EPG Grabber Modules. At this point you should see many more internal grabbers. Find ** Internal: XMLTV: tv_grab_zap2xml is a simple wrapper for zap2xml.py** and enable it. Run the internal EPG grabbers. In the log window, it should say xmltv: /usr/bin/tv_grab_zap2xml: grab /usr/bin/tv_grab_zap2xml and spawn: Executing “/usr/bin/tv_grab_zap2xml” After it has finished running it will give you information about the grab in the log window.

  15. On the website, navigate to EPG Grabber Channels and link the EPG data to the proper channel. It can also be done through the Channels Tags page. It may take a couple minutes for TVH to parse through the data and allow you to link the data to the channels. A restart of the device may also allow this step sooner.

  16. Navigate to EPG Grabber and select when you want the grabber to run via CRON.

  17. EPG data should start to show up in KODI. You can point a new browser to your device:9981\xmltv page to see if the data is there. For example: http://192.168.0.100:9981/xmltv

  18. Go back to the config page for zap2xml and select your options. Change the number of days to a more appropriate value.

1 Like

The only additional step I needed was to restart tvheadend before the internal xmltv grabbers showed up in the list.

sudo service tvheadend restart

Thanks. I added that after step #12.

On your device navigate to /home/osmc/.kodi/userdata/addon_dara/script.module.zap2xml

it’s addon_data not dara…lol

thanks working great!!

Dan

In January 2018 the zap2it site changed it’s interfaces. The perl zap2xml tool has received fixes, but the python zap2xml recommended in this tutorial has not yet as a Feb 5, 2018. See the changelog listed on the perl version’s page

For queries about addons you are much better served by the Kodi forum http://forum.kodi.tv/forumdisplay.php?fid=27 or by contacting the add-on developer directly.

You must uninstall the zap2xml addon from Kodi and then install the zap2epg addon. I have it working on my RPi3 with the latest OSMC updates.

You will also have to copy the tv_grab_zap2epg to the /usr/bin folder and chmod to 777.

Follow the prompts in the addon to select the channels to download and then restart.

Go to the TVH website and change your channel information with the new zap2epg information.

Probably better to chmod to 755.