Project

General

Profile

How to build a PVR in the USA using HDHomerun Extend + Raspberry Pi 3 + Kodi + Tvheadend + XMLTV + Schedulesdirect

Added by W Beauchamp over 8 years ago

3/24/2016
Goal: set up a DVR for the over-the air TV available in Chicago, Illinois USA
I didn't ever find any documentation that explained completely what I need to do to get it all working, so I am documenting it here. I'm experienced with Linux and Windows but a NOOB with KODI / XBMC. After spending several days trying to figure out how to configure it, I finally have a completely working environment with my local stations showing up in Kodi and their associated show schedules.

Video source: HDHomerun Extend.
PVR hardware: Raspberry Pi 3 with 32GB SD memory
Media Center: Kodi / OSMC
Flirc remote receiver
WD 314GB PiDrive (still waiting for it)
Location: Chicago

The first thing to do was choose a flavor of Kodi / XBMC. First I tried OpenElec, which was easy to install. Next I had to decide on a PVR (DVR) back server. Both a PVR server and client are required. I decided on tvheadend.

I had to install tvheadend server from the OpenElec unofficial add-ins repository. After spending many hours searching the web I could not get tvheadend to detect any MUXes. It seems a major issue is that both OpenElec and tvheadend are very Euro-centric, and I am in the United States for which no documentation exists. Also the tvheadend configuration seems to change rapidly, so there are lots of instructions that are no longer valid.

I decided to install OSMC instead of OpenElec. The installation was well documented on their site. One caveat is that when the installer asks where you want to install OSMC, it means on the Raspberry Pi, not the computer you are installing on. If you are using a USB adapter for the micro SD card, you choose SD card, not USB. I like the OSMC skin better than the Kodi skin.
Tvheadend server is very easy to install from the "My OSMC" App Store. Restart the Raspberry Pi after installing tvheadend.

Next Configure tvheadend 4.0.7
- Determine Raspberry Pi IP
- Launch tvheadend web based config: http://Raspberry-Pi-IP:9981/
- log in (osmc, osmc)
- Click conguration
- Click DVB inputs
- Click Networks. Add a new network. Choose Type: ATSC. Give it any name, I am using "osmc8".
- Click TV adaptors - you should see the HDHomerun tuners (or other tuners you may have) displayed.
- Open the system log by clicking the double ^ symbol in the lower right corner.
- Click HDHomeRun folder icon, change the network type to ATSC. ATSC is used for over the air broadcasts in the USA. Click Save.
- Click TV adaptors.
- Click each HDHomeRun tuner. Enable it. Change the network to "osmc8". Turn off idle scan. Save.
- Click Networks.
- Click Pre-defined Muxes:
- Choose "United States: us-ATSC-center-frequencies-8VSB". Save.
- Click Look for errors in the log. You may have to reboot the HDHomeRun if you see "locked" messages and the click force scan again.
- Click Muxes. You should see a bunch of muxes. These are the potential base channels. You should see "Pending" in scan results until it detects channels.
- The channel that exist will say "OK", the others will say "FAIL".
- Click Services, you should see all of the channels you can receive with your TV.
- Click Map All, click the "check availability" checkbox.
- Click "Channel / EPG", Channels, Uncheck the channels you don't want to see, then save.

Here's another good tutorial: https://discourse.osmc.tv/t/howto-tvheadend-setup-of-ip-tv-with-osmc-and-the-avm-fritz-wlan-repeater-dvb-c/8471

In retrospect, tvheadend would have worked on OpenElec too, but I had to flail around for a while before I discovered that.

There are two ways to get OTA scheduling, one in zap2xml, the other is http://www.schedulesdirect.org/ ($25 per year). I chose schedulesdirect because NOOB.
After you sign up, click "Add a new lineup". Choose the lineup for your area.

This was the most difficult part to figure out.

- Install Putty to get you terminal access to your OSMC / tvheadend server.
- Log into the server (osmc, osmc)
- To install xmltv, run:
sudo apt-get install xmltv-util
sudo apt-get update

Here's the xmltv config according to http://wiki.xmltv.org/index.php/HowtoUseGrabbers

From the command line, run: "tv_find_grabbers baseline manualconfig" to list the available grabbers
"tv_grab_na_dd" is the grabber to use for schedulesdirect.org.
This file references docs.tms.tribune.com, which is no longer valid.
Edit /usr/bin/tv_grab_na_dd and replace all references of docs.tms.tribune.com to dd.schedulesdirect.org. The rest of the URL remains the same.
run: "sudo vi /usr/bin/tv_grab_na_dd" to edit the file
run: mkdir /home/osmc/.xmltv
run: "tv_grab_na_dd --config-file /home/osmc/.xmltv/tv_grab_na_dd.conf" to build the config file.
Log in to www.schedulesdirect.org with your schedulesdirect userID and password, choose the lineup, etc.
run: tv_grab_na_dd --output /home/osmc/.xmltv/tv_grab_file.xmltv --quiet to generate a test xml file
run: sudo reboot now

Log into the tvheadend web page
Go to Configuration -> Channel / EPG -> <>EPG Grabber
In General Config, uncheck all.
In Internal Grabber, chose the "XMLTV: North America (Data Direct) grabber.
Uncheck all items in Over-the-air grabbers
Uncheck all items in External Interfaces.
Click the tiny double ^ icon in the lower right to open the system log window.
Click save configuration. If everything worked right you should see it download schedules and channels.
Wait until it finishes, then reboot
Go to Configuration -> Channel / EPG -> <>EPG Grabber -> Channels
Uncheck the channels you don't want to see.
Click on each channel, click the edit button and choose the EPG source for each channel. Save.

Reboot and close your browser
Log into the tvheadend web page
Wait a few minutes then click refresh on the Electronic Program Guide. Schedules should show up.

Installing the client side of tvheadend on OSMC is confusing but not as bad.
From the OSMC interface, go to System, Add-Ons, My Add-ons, PVR Clients, and choose Tvheadend HTSP Client.
Configure Tvheadend userID and password (osmc / osmc).
Enable Tvheadend HTSP Client.
Go to Settings, TV, General and enable it.

Now you will see the "Live TV" menu option, and be able to browse TV channels.

I'll update this if things change and I have to fix anything or if there are more configurations that I don't know about yet...

3/29 update
Testing OSMC interface via HDMI on the HDTV.
You can view the TV schedule.
You can schedule a show to be recorded.
You can play back a recorded show, and it looks great!
Due to an versioning issue between the Tvheadend client and Tvheadend server included with OSMC, you cannot view live TV from Tvheadend client.
HD Recording works fine via WiFi because HDHomeRun Extend "Converts video to H.264 AVC for more efficient streaming and better playback support on portable devices".

Still to test:
Test HDHomeRun client to see if it co-exists with the TvHeadend client / server.

-W


Replies (37)

RE: How to build a PVR in the USA using HDHomerun Extend + Raspberry Pi 3 + Kodi + Tvheadend + XMLTV + Schedulesdirect - Added by G Kazaroth over 7 years ago

I am so sorry. It has been a while since I did the setup and I missed a step. You need to change tv_grab_na_tvmedia to use tv_grab_file. To do this on the TVHeadend website, go to
Configuration -> Channel / EPG -> EPG Grabber Modules
A list will appear. Go through it and make sure nothing is checked on the left side (just a round dot should be present instead of a round dot with a check inside)
Look for "Internal: XMLTV: tv_grab_file reads ..." and enable that. That line should now have a check on the left. Now when it runs, it should find the file.

RE: How to build a PVR in the USA using HDHomerun Extend + Raspberry Pi 3 + Kodi + Tvheadend + XMLTV + Schedulesdirect - Added by Edward Crosby over 7 years ago

Sorry. I may be a little dim. I'm not seeing what you are describing. All that I have is EPG Grabber not EPG Grabber Modules. Screenshot attached. I'm running 4.0.9-16~g63c1034~xenial, if that makes a difference.

RE: How to build a PVR in the USA using HDHomerun Extend + Raspberry Pi 3 + Kodi + Tvheadend + XMLTV + Schedulesdirect - Added by G Kazaroth over 7 years ago

OK, you are running 4.0.x and I am running 4.1.x, so we have different GUIs. I think yours does not have the module tab yet, so the grabber should be on the pull down in the internal grabber section called Modules.

Also, You need to disable the OTA Grabber section. I don't believe tvguides are provided on OTA anymore. I just clear that section out so it is empty and does not impact your service. You can also do what you want for the top check boxes, but after a bit, you may want to have control over what the channel name says on your tvguide and the icons I don't have coming from the xmltv.xml file.

Hope this helps.

RE: How to build a PVR in the USA using HDHomerun Extend + Raspberry Pi 3 + Kodi + Tvheadend + XMLTV + Schedulesdirect - Added by Edward Crosby over 7 years ago

So, I was trying to figure out how to get 4.1 on my Ubuntu 16.04 machine a few days ago and could never figure out how to get it. Here is my source list, I don't remember where I got this from:

deb http://apt.tvheadend.org/stable xenial main

From TVHeadend site I found this the other day:

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 379CE192D401AB61

echo "deb https://dl.bintray.com/tvheadend/deb xenial release" | sudo tee -a /etc/apt/sources.list

However, if I remember correctly while testing on a VM I attempted to use the "unstable" and never received 4.1.
Which source are you using?
And finally, George - Kazaroth, I want to truly thank you for your quick responses and assisting me on this thread. You have been incredibly helpful.
After all is completed and working for me I plan on documenting all these steps and posting to my blog for my own future reference and for anyone else looking to do what I am doing with an OTA antenna and PVR on an Ubuntu server.

RE: How to build a PVR in the USA using HDHomerun Extend + Raspberry Pi 3 + Kodi + Tvheadend + XMLTV + Schedulesdirect - Added by G Kazaroth over 7 years ago

deb http://apt.tvheadend.org/unstable xenial main # 16.04

I was having issues about 1 year ago and the stable version was way too slow at getting out the needed updates. I have not have many issues with the unstable version. About the only issue I have is when I reboot, the recording list disappears from tvheadend, but I have it cataloged through Emby and through the harddrive, so I really don't need it on Kodi.

I use the command sequence
sudo apt-get update
sudo apt-get dist-upgrade
sudo apt-get upgrade

Good luck

RE: How to build a PVR in the USA using HDHomerun Extend + Raspberry Pi 3 + Kodi + Tvheadend + XMLTV + Schedulesdirect - Added by Edward Crosby over 7 years ago

I was able to upgrade to 4.1. I do not see Internal: XMLTV: tv_grab_file in the EPG Grabber Modules tab.

RE: How to build a PVR in the USA using HDHomerun Extend + Raspberry Pi 3 + Kodi + Tvheadend + XMLTV + Schedulesdirect - Added by G Kazaroth over 7 years ago

Sounds like you are close. Try this
1) ls /usr/bin/tv_*
see if you have a ton of tv_grab* files. The one you want should be missing. I have 52 files.
2) tv_find_grabbers
If you have the command, it again should display a pretty long list and probably will have the tv_grab_file missing.
3) apt list | grep xmltv
This should give you a list including the packages xmltv-util and libxmltv-perl. Those should say "[installed,automatic]" if installed.
4) I believe the xmltv-util is the one you need to install with sudo apt-get install xmltv-util
Try the commands again and see if the grabbers got installed.
The files are text, so I included the file you have missing in case it might help.

RE: How to build a PVR in the USA using HDHomerun Extend + Raspberry Pi 3 + Kodi + Tvheadend + XMLTV + Schedulesdirect - Added by Edward Crosby over 7 years ago

Yeah, thanks for that. After long researching I had found that file was missing. I downloaded it from the github page, moved it to /usr/bin and gave it executable permissions for everyone. The issue I am at now is that I found that at the beginning of the file is that it is referencing a file that does not exist (cat ~/.xmltv/tv_grab_file.xmltv) and I haven't found anywhere how this file is supposed to be created and what is supposed to be in the .xmtltv file. I had assumed it is referencing all the EPG channel information so I commented out that line and pointed it to my .xml file that the perl script created but it still doesn't seem to be working. Here is what I did:

if (( $# < 1 ))
then
#  cat ~/.xmltv/tv_grab_file.xmltv
        cat /home/ed/xmltv/xmltv.xml
  exit 0
fi

RE: How to build a PVR in the USA using HDHomerun Extend + Raspberry Pi 3 + Kodi + Tvheadend + XMLTV + Schedulesdirect - Added by Edward Crosby over 7 years ago

Looks like I may have spoke too soon. When I got home from work I see that I can add EPG sources to my OTA channels.
I guess updating that file to reference my .xml file worked.

RE: How to build a PVR in the USA using HDHomerun Extend + Raspberry Pi 3 + Kodi + Tvheadend + XMLTV + Schedulesdirect - Added by G Kazaroth over 7 years ago

The attached screenshot is the result on Kodi 17 estuary of the zap2it xmltv with the category/genre update. You will notice the origination date, original genre and season/episode listed on top of the description. Also, the season/episode number is listed in the subtitle. The genre listed is what tvheadend needs versus the original genre. More colors are present instead of grey due to the genre update.

RE: How to build a PVR in the USA using HDHomerun Extend + Raspberry Pi 3 + Kodi + Tvheadend + XMLTV + Schedulesdirect - Added by Edward Crosby over 7 years ago

What's happening if my EPG is not updating? After a few days, and currently, I no longer see shows scheduled in the EPG tab.

(26-37/37)