Add EPG to TVheadend
Tvheadend comes with a built-in electronic programming guide (EPG). An EPG is like a TV guide providing show start and stop times and a description of the show. The default North American EPG (PSIP ATSC) pulls information about upcoming shows from the over-the-air broadcast signal.
I am not satisfied with the level of detail provided by PSIP ATSC about the shows and channels.
After some research, xmltvlistings, Schedules Direct and zap2it seem to be the best alternatives for broadcast TV channels in the US. Schedules Direct and xmltvlistings charge a fee (~$20/yr), and zap2it is free. Initially, I used zap2it, but after a while zap2it changed its website and downloading EPG data broke. The download code was updated, but the new code failed to download the EPG data. Also, the zap2xml page contains a link to mc2xml, and the link contains a virus. So, I switched to Schedules Direct. I forget why, but later I switched to xmltvlistings.com.
Step 1. Register for Schedule Direct account
Follow this link to xmltvlistings.com
Complete the registration page (image 2)
Click Signup! button
xmltvlistings should go to your account page. If not, login using your email and password
Step 2. Select your channels
Broadcasters are actually transmitting many channels. For example, in my area, The CW (54.1) is broadcasting LAFF (54.2) and Grit (54.3).
I set my system up to only use the main channels in Central Texas: ABC (24.1), CBS (42.1), The CW (54.1), Fox (7.1), NBC (36.1), PBS (18.1), and PBS Kids (18.4). You can choose whatever channels are available. You can always add more channels later.
By default all channels are included
Click on the link "Add Lineup" (image 1)
Enter your zip code
Select "Broadcast (Antenna)"
Add your favorite channels (image 3)
These are mine: ABC (24.1), CBS (42.1), The CW (54.1), Fox (7.1), NBC (36.1), PBS (18.1), and PBS Kids (18.4)
Click "Save"
Step 3. Setup utilities on TVheadend server
TVheadend needs to read an xml file from xmltvlistings.com.
It uses /usr/bin/tv_grab_na_tvmedia. If you do not have this installed, then run:
$ sudo apt-get install xmltv-util
Open a terminal window on your MacBook and log into the the tvheadend server using one of the following:
$ ssh ♣username♣@♣tvheadend-hostname♣.local
$ ssh ♣username♣@♣tvheadend-server-ip-address♣
Step 4. Configure Schedules Direct
Your API Key can be found on your account page (see Image)
Configure Schedules Direct by running the command:
$ sudo su - hts
hts$ /usr/bin/tv_grab_na_tvmedia --configure
API Key: ♣your-api-key♣
Choose one of your lineups. You can add or modify lineups from your account page (https://www.xmltvlistings.com/account/)
Lineup:
0: Broadcast-Cedar Park, TX
Select one: [0 (default=0)] 0
hts$ logout
Step 5. Enable /usr/bin/tv_grab_na_tvmedia
Open a browser and go to your tvheadend installation
http://tvheadend.local:9981/extjs.html
I keep a short cut to my tvheadend in my browser and store username and password
In TVHeadend website, go to Configuration -> Channel / EPG -> EPG Grabber Modules
For each green check, (only do one at a time)
Uncheck the Enabled box, and
Save
You may have to refresh the page to ensure the green check are all gone
Now, look for "Internal: XMLTV: North America (XMLTVListings.com by TVMedia"
In the lower right corner, click on the double up arrow icon, which opens the log window
Select the line with tv_grab_file
Check the Enabled box
Save
the log window will show whether it is working or not (The log appears if you click on the bottom bar)
Step 6. EPG Grabber
In TVHeadend website, go to Configuration -> Channel / EPG -> EPG Grabber
Check "Update Channel Number" left this unchecked
In Cron multiline:
# grabber runs at 6am. Grabber runs at 6am, 2pm and 6pm everyday
0 6 * * *
0 14 * * *
0 18 * * *
Click Save
Configuration : Channel EPG : EPG Grabber Channels
Click on a row, then edit, pick channel from EPG Source drop down and Save
Or, EPG Source select the appropriate channel
Configuration : Channel EPG : Grabber Modules
Rerun internal EPG grabbers
https://www.xmltvlistings.com/xmltv/get/♣your-api-key♣/2