Below is a guide to how watch live TV in XBMC using the HDHomerun Prime. It uses the UPnP DNLA streams output by the HDHR prime and the TV Guide plug-in for listings.
Requirements:
- HDHR Prime firmware version 20130328 (earlier versions don’t have the DNLA streams)
- XBMC 11.0 Eden (XBMC 12.0 Frodo appears to have problems playing the DLNA DMS streams)
Platform:
I was able to do the following on both a minitower running Linux Mint 14 and my Raspberry Pi running Raspbmc. I ended up choosing to use the minitower over the RasPi, because the RasPi would not reliably play the HD streams. The issue I ran into on the RasPi was that the audio and the video would become noticeably out of sync, and I was unable to fix this issue.
Watching TV:
Watching TV is easy: Go into videos and add the HDHR DLNA streams to your list of video sources. It should appear as HDHomeRun Live DMS [DEVICEID] under UPnP Devices.
Interactive TV guide:
- Install the TV Guide add-on under Programs (I used version 1.4.1 of the plugin by twinther)
- Find a data source for your listings (I use SchedulesDirect)
- Install xmltv-util.
Configure the listings by running:
tv_grab_na_dd --configure
And then grab some TV guide data:
tv_grab_na_dd --days 7 --output tv_guide.xml
Now, go to your TV Guide add-on and set the soruce to XMLTV and point it to tv_guide.xml. The problem is that your channels will all be out of order and not associated with a stream. To fix this, I used a short python script that reorders the channels in the SQLite3 database and associates each with a stream. If you want to use this script, just put it in your home folder and update base_stream_url to point to the base stream URL for your HDHR:
#!/usr/bin/python
import sqlite3
# connect to the database, assuming this is being run from your home folder. Update as necessary
conn = sqlite3.connect(".xbmc/userdata/addon_data/script.tvguide/source.db")
# My upnp streams from my hdhr prime are of this form, with the channel number appended to the end.
# You can check in your database what your URLs look like:
base_stream_url = "upnp://F0825638-3C44-3B2F-A8F4-77592DA05EA9/CableTV%2fv"
c = conn.cursor();
c.execute("select title,id from channels");
results = c.fetchall();
# Loop over all the channels
for result in results :
# Extract the real channel number from the title and set it to the weight
tmp = result[0].split();
channel_number = tmp[0];
channel_name = tmp[1];
channel_id = result[1];
c.execute("update channels set weight="+channel_number+" where id=\""+channel_id+"\"");
stream_url = base_stream_url+channel_number ;
c.execute("select channel from custom_stream_url where channel=\""+channel_id+"\"");
tmp = c.fetchone();
if tmp :
query = "update custom_stream_url set stream_url='"+stream_url+"' where channel='"+channel_id+"'"
else :
query = "insert into custom_stream_url VALUES ('"+channel_id+"','"+stream_url+"')"
print(query)
c.execute(query)
conn.commit();
conn.close()