03-04-2015, 03:24 PM
I just wanted to drop a note for anyone who will be using the Raspberry Pi 2 with OpenElec and TVHeadEnd on how to get it all setup. I spent a couple of days on this and wanted to document it. It is not as straightforward as one would hope (or at least it wasn't for me).
Note that this setup is for US ATSC and all machines are running linux, so I don't have any advice for non-US or Windows.
The first thing you will need to do is purchase an MPG2 license from Raspberry Pi store. It cost about $3 USD. If you don't have this, you will get no video, only audio.
Second, I highly recommend using a powered USB hub. My tuner is the WinTV-HVR-950, and it draws enough power to overwhelm the 5V 2A power supply.
You will need to install the TVHeadEnd server. This is done in OpenElec interface by adding the Unsupported OpenElec repository to the Addons. Once you do this, initiate a refresh of the addons. When this completes, you will see the TVHeadEnd server addon under Services in the Unsupported repository. Install this and then reboot.
After reboot, you will need the access the TVHeadEnd web interface at http://<ip addr of your raspberry>:9981. On this page, choose Configuration Tab, then go to DVB Inputs. You should see your TV Adapter listed here. If you don't, then you need to check to make sure your adapter is supported by TvHeadEnd, etc.
Select the Adapter and Service type. In my case, since I'm in the USA, I wanted the ATSC. On the right hand side, check to enable the device. Also, uncheck Initial Scan and Idle Scan. Click Save.
Now click on the Networks tab. Click Add to create a new network. You will be asked to select a Type; make this the same as the Adapter Service type. In my case, this was the ATSC Network. Now enter a descriptive name. Check Network Discovery, uncheck Skip Initial Scan. Click Save.
Now click on the Muxes tab. Choose the network you just created.
Go back to the TV Adapters tab and select the Adapter/Service. On the right hand side, select the network in the Networks drop down. Click save.
Now reboot the raspberry pi.
After reboot, the tvheadend will start up scan the adapter looking for channels. Connect back to the web page and click on Configuration/DVB Inputs/Networks tab. You should start to see the # Muxes # Sevices numbers start to change. If you click on the Muxes tab you will see the channel frequencies. Notice the SCAN RESULT. If it says OK, a signal was detected on that channel. You wait a few minutes for the scan to complete.
Now click on the Services tab. Click on the Map All button. Then click Map. The channels that were detected will now be displayed. At this point we should be ready to watch TV on the raspberry. I would suggest a final reboot of the Raspberry.
On the OpenElec interface, you will need to install the TVHeadEnd client in the Addons. Once this is installed, go back to the System configuration, select Live TV, and enable it. You should now have a TV option on the main screen (you may need to reload your skin.) You should now be able to selected channels and watch TV!
Now for the EPG. This will be very dependent on your location. In the US, TVHeadEnd cannot grab EPG info from over the air signal, so we must use a third party to download the information and import it into TVHeadEnd. I use http://www.schedulesdirect.org/ which will provide the information for $25 / year with a 7 day free eval.
There are 2 ways to get the info into TVHeadEnd, manual and automatic. Either way, you will need a computer that has XMLTV utils installed. You can download this from http://sourceforge.net/projects/xmltv/files/xmltv, but on my debian machine I installed from apt-get. I assume the Windows version is similar, but my instructions will be linux based.
In my situation, I have a debian based nas server. So I installed xmltv-utils on it. You must configure the grab utility first, so execute this in a terminal:
I took the defaults for all options. I did encounter one issue. A web site it was trying to connect to was timing out. I found a workaround online by editing the /etc/hosts file and putting the following line:
I then setup a cron job to grab the data from Schedules Direct every day and put the file on my web server. This is done by running the following command:
This will create a file that contains the epg data. You can also run this command manually to create the file.
Now that we have the file, we need to get it over to the Raspberry PC so that TVHeadEnd can process it. Since I am putting my file on an internal web server, I can simply use wget to grab the file and put it on a my Raspberry server, in this case I created a folder in /storage called epg and put the file there. To start things, I ssh into the Raspberry and ran the following command to get the initial file.
Now, back in OpenElec, go to the TVHeadEnd server addon and click Configure. There is a tab to configure the XMLTV. You will want to enable this and specify the location of the file that is on the Raspberry (in my case /storage/epg/epg.xml)
TVHeadEnd uses a simple script to read the contents of the file. It is located in /storage/.kodi/addons/service.multimedia.tvheadend/bin/tv_grab_file. You will want to open this script file in an editor (nano). I added the following 2 lines to the script at the beginnning:
So, everytime TVHeadEnd executes the tv_grab_file script, it will automatically grab the latest file from the web server.
Now, go back to the TVHeadEnd web interface. Click on Configuration/Channel EPG/EPG Grabber. Under General Config check the 3 Update channel info. Uncheck all modules in the Over-the-air grabbers and external interfaces. Click Save. Under Internal Grabber, the Module dropdown may or may not have an additional option besides Disabled at this point. If it does, choose it and click Save again. If it doesn't, you might want to reboot the Raspberry, then come back to this page. After you are able to select the new Module, click save configuration.
If everything is setup correct, TVHeadEnd should now have loaded the EPG data. The last step is to Map the channels to the EPG data. This is done in the Configuration/Channel EPG/Channels tab. You will need to go to each channel, then select the drop down under the EPG Source column and match to the correct EPG channel data. After this is done, I suggest another reboot.
Once Openelec is back up, you should have your EPG data on screen. If you don't, you will need to go back to the TVHeadEnd web GUI and look at the system log to see what errors you may be getting.
I hope this has been helpful. Please feel free to post any comments and corrections. I will try and get screenshots for some of the items soon.
Note that this setup is for US ATSC and all machines are running linux, so I don't have any advice for non-US or Windows.
The first thing you will need to do is purchase an MPG2 license from Raspberry Pi store. It cost about $3 USD. If you don't have this, you will get no video, only audio.
Second, I highly recommend using a powered USB hub. My tuner is the WinTV-HVR-950, and it draws enough power to overwhelm the 5V 2A power supply.
You will need to install the TVHeadEnd server. This is done in OpenElec interface by adding the Unsupported OpenElec repository to the Addons. Once you do this, initiate a refresh of the addons. When this completes, you will see the TVHeadEnd server addon under Services in the Unsupported repository. Install this and then reboot.
After reboot, you will need the access the TVHeadEnd web interface at http://<ip addr of your raspberry>:9981. On this page, choose Configuration Tab, then go to DVB Inputs. You should see your TV Adapter listed here. If you don't, then you need to check to make sure your adapter is supported by TvHeadEnd, etc.
Select the Adapter and Service type. In my case, since I'm in the USA, I wanted the ATSC. On the right hand side, check to enable the device. Also, uncheck Initial Scan and Idle Scan. Click Save.
Now click on the Networks tab. Click Add to create a new network. You will be asked to select a Type; make this the same as the Adapter Service type. In my case, this was the ATSC Network. Now enter a descriptive name. Check Network Discovery, uncheck Skip Initial Scan. Click Save.
Now click on the Muxes tab. Choose the network you just created.
Go back to the TV Adapters tab and select the Adapter/Service. On the right hand side, select the network in the Networks drop down. Click save.
Now reboot the raspberry pi.
After reboot, the tvheadend will start up scan the adapter looking for channels. Connect back to the web page and click on Configuration/DVB Inputs/Networks tab. You should start to see the # Muxes # Sevices numbers start to change. If you click on the Muxes tab you will see the channel frequencies. Notice the SCAN RESULT. If it says OK, a signal was detected on that channel. You wait a few minutes for the scan to complete.
Now click on the Services tab. Click on the Map All button. Then click Map. The channels that were detected will now be displayed. At this point we should be ready to watch TV on the raspberry. I would suggest a final reboot of the Raspberry.
On the OpenElec interface, you will need to install the TVHeadEnd client in the Addons. Once this is installed, go back to the System configuration, select Live TV, and enable it. You should now have a TV option on the main screen (you may need to reload your skin.) You should now be able to selected channels and watch TV!
Now for the EPG. This will be very dependent on your location. In the US, TVHeadEnd cannot grab EPG info from over the air signal, so we must use a third party to download the information and import it into TVHeadEnd. I use http://www.schedulesdirect.org/ which will provide the information for $25 / year with a 7 day free eval.
There are 2 ways to get the info into TVHeadEnd, manual and automatic. Either way, you will need a computer that has XMLTV utils installed. You can download this from http://sourceforge.net/projects/xmltv/files/xmltv, but on my debian machine I installed from apt-get. I assume the Windows version is similar, but my instructions will be linux based.
In my situation, I have a debian based nas server. So I installed xmltv-utils on it. You must configure the grab utility first, so execute this in a terminal:
Code:
tv_grab_na_dd --configure
I took the defaults for all options. I did encounter one issue. A web site it was trying to connect to was timing out. I found a workaround online by editing the /etc/hosts file and putting the following line:
Code:
54.85.117.227 docs.tms.tribune.com webservices.schedulesdirect.tmsdatadirect.com
I then setup a cron job to grab the data from Schedules Direct every day and put the file on my web server. This is done by running the following command:
Code:
tv_grab_na_dd > /path/to/a/file
This will create a file that contains the epg data. You can also run this command manually to create the file.
Now that we have the file, we need to get it over to the Raspberry PC so that TVHeadEnd can process it. Since I am putting my file on an internal web server, I can simply use wget to grab the file and put it on a my Raspberry server, in this case I created a folder in /storage called epg and put the file there. To start things, I ssh into the Raspberry and ran the following command to get the initial file.
Code:
wget http://<webserver/epg.xml -O /storage/epg/epg.xml
Now, back in OpenElec, go to the TVHeadEnd server addon and click Configure. There is a tab to configure the XMLTV. You will want to enable this and specify the location of the file that is on the Raspberry (in my case /storage/epg/epg.xml)
TVHeadEnd uses a simple script to read the contents of the file. It is located in /storage/.kodi/addons/service.multimedia.tvheadend/bin/tv_grab_file. You will want to open this script file in an editor (nano). I added the following 2 lines to the script at the beginnning:
Code:
rm /storage/epg/epg.xml
wget http://<webserver/epg.xml -O /storage/epg/epg.xml
So, everytime TVHeadEnd executes the tv_grab_file script, it will automatically grab the latest file from the web server.
Now, go back to the TVHeadEnd web interface. Click on Configuration/Channel EPG/EPG Grabber. Under General Config check the 3 Update channel info. Uncheck all modules in the Over-the-air grabbers and external interfaces. Click Save. Under Internal Grabber, the Module dropdown may or may not have an additional option besides Disabled at this point. If it does, choose it and click Save again. If it doesn't, you might want to reboot the Raspberry, then come back to this page. After you are able to select the new Module, click save configuration.
If everything is setup correct, TVHeadEnd should now have loaded the EPG data. The last step is to Map the channels to the EPG data. This is done in the Configuration/Channel EPG/Channels tab. You will need to go to each channel, then select the drop down under the EPG Source column and match to the correct EPG channel data. After this is done, I suggest another reboot.
Once Openelec is back up, you should have your EPG data on screen. If you don't, you will need to go back to the TVHeadEnd web GUI and look at the system log to see what errors you may be getting.
I hope this has been helpful. Please feel free to post any comments and corrections. I will try and get screenshots for some of the items soon.