{"id":1843,"date":"2014-07-07T21:29:41","date_gmt":"2014-07-07T09:29:41","guid":{"rendered":"http:\/\/www.zoyinc.com\/?p=1843"},"modified":"2017-04-06T06:02:30","modified_gmt":"2017-04-05T18:02:30","slug":"epg-terrestrial-and-hdhomerun","status":"publish","type":"post","link":"http:\/\/www.zoyinc.com\/?p=1843","title":{"rendered":"MythTV, EPG, Terrestrial and HDHomeRun"},"content":{"rendered":"<p><a  href=\"http:\/\/www.zoyinc.com\/wp-content\/uploads\/2013\/02\/MythTVLogo1Featured.jpg\" class=\"thickbox no_icon\" title=\"MythTV\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-873\" src=\"http:\/\/www.zoyinc.com\/wp-content\/uploads\/2013\/02\/MythTVLogo1Featured.jpg\" alt=\"MythTV\" width=\"198\" height=\"94\" srcset=\"http:\/\/www.zoyinc.com\/wp-content\/uploads\/2013\/02\/MythTVLogo1Featured.jpg 198w, http:\/\/www.zoyinc.com\/wp-content\/uploads\/2013\/02\/MythTVLogo1Featured-150x71.jpg 150w\" sizes=\"auto, (max-width: 198px) 100vw, 198px\" \/><\/a>Recently we switched our MythTV system from using satellite to terrestrial reception using the HDHomeRun by <a  href=\"http:\/\/www.silicondust.com\/\">SiliconDust.<\/a> Unfortunately what had been a perfectly working EPG under satellite turned into a one day wonder under terrestrial &#8211; I could only see one days listing.<\/p>\n<p>I should point out that we live in New Zealand and the problems may be influenced by the particular setup we have here. I am running MythTV 0.25, Fedora 16, Intel core i7 , 6GB RAM with an HDHomeRun.<\/p>\n<p>I have tried to get EPG, Electronic Program Guide, working for a while without much success and gave up. Recently though I gave it another go with more sucess. Now it seems to be fine, albeit without the all the detail like categories and this is my story on what I did. It&#8217;s written in hindsight and so possible there are some mistakes.<\/p>\n<h2>Resources<\/h2>\n<p>MythTV NZ mailing list:<br \/>\nmythtvnz@lists.linuxnut.co.nz<\/p>\n<p>Post to MythTV NZ mailing list by <b>Paulgir<br \/>\n<\/b><a  href=\"http:\/\/lists.ourshack.com\/pipermail\/mythtvnz\/2012-January\/012377.html\">http:\/\/lists.ourshack.com\/pipermail\/mythtvnz\/2012-January\/012377.html<\/a><\/p>\n<p>Hans from Nice Technology<br \/>\n<a  href=\"http:\/\/nice.net.nz\/\">http:\/\/nice.net.nz\/<\/a><\/p>\n<h2>Background<\/h2>\n<p>Getting the EPG from New Zealand terrestrial in MythTV has been a problem for a while with various theories about why.<\/p>\n<p>After trying for sometime to get the EPG from the DVB-T broadcast I reluctantly decided to get my listings from <a  href=\"http:\/\/www.epg.org.nz\/\">http:\/\/www.epg.org.nz\/ <\/a>&#8211; the pragmatic solution. At epg.org.nz they produce an xml file containing most of TV channels in NZ and their tv listings for the next 8 days. The MythTV grabber downloads the listings and inserts the listings into MythTV.<\/p>\n<h2>Steps<\/h2>\n<p>Having a combination of satellite and terrestrial receivers seems to cause problems it certainly did for me. My suggestion would be to stick to one or the other if possible. This post assumes you are only using terrestrial and in my case a HDHomeRun.<\/p>\n<p>To make things simpler we will refer to the user that runs mythbackend as the &#8220;mythtv user&#8221;.<\/p>\n<table class=\"zsteps\" border=\"0\">\n<tbody>\n<tr>\n<td>1.<\/td>\n<td>Download a copy of &#8216;tv_grab_nz-py&#8217; from <a  href=\"http:\/\/nice.net.nz\/tv_grab_nz-py\/\">http:\/\/nice.net.nz\/tv_grab_nz-py\/<\/a><\/td>\n<\/tr>\n<tr>\n<td>2.<\/td>\n<td>\n<p style=\"text-align: left;\">Some people have reported problems with the script and in the process of trying to get it working for me, I took these suggestions and edited the script:<\/p>\n<table class=\"zsteps2 alignleft\" border=\"0\">\n<tbody>\n<tr>\n<td style=\"text-align: left;\">\u00a0a.<\/td>\n<td>Change the script to use python 2, so change:<\/p>\n<p style=\"padding-left: 30px;\">#!\/usr\/bin\/python<\/p>\n<p>to<\/p>\n<p style=\"padding-left: 30px; text-align: left;\">#!\/usr\/bin\/python2<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>b.<\/td>\n<td>To get the encoding right search for:<\/p>\n<p style=\"padding-left: 30px;\">doc = ElementTree.parse(StringIO(text)).getroot()<\/p>\n<p>and replace it with<\/p>\n<p style=\"padding-left: 30px;\">parser = ElementTree.XMLParser(encoding=&#8221;ISO-8859-1&#8243;)<br \/>\ndoc = ElementTree.parse(StringIO(text), parser=parser).getroot()<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>c.<\/td>\n<td>Sometimes the script doesn&#8217;t like certain characters in the channel name so search for:<\/p>\n<p style=\"padding-left: 30px;\">use = raw_input(&#8216;Use channel %s (%s)? [y\/N]&#8217; % (channel[1], channel[0]))<\/p>\n<p>and replace with<\/p>\n<p style=\"padding-left: 30px;\">use = raw_input(&#8216;Use channel %s (%s)? [y\/N]&#8217; % (channel[1].encode(&#8216;ascii&#8217;, &#8216;ignore&#8217;), channel[0]))<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/td>\n<\/tr>\n<tr>\n<td>3.<\/td>\n<td>The above changes aren&#8217;t a perfect solution but made it work for me. So there is a good chance you might be able to enhance it further.With many thanks to Hans from <a  href=\"http:\/\/nice.net.nz\/\">Nice Technology<\/a>, my version of the script can be found here: <a  href=\"http:\/\/www.zoyinc.com\/wp-content\/uploads\/2014\/06\/tv_grab_nz-py_tp.zip\">tv_grab_nz-py_tp.zip<\/a> (Obviously it will need to be unzipped)<\/td>\n<\/tr>\n<tr>\n<td>4.<\/td>\n<td>You need to put this script somewhere in the PATH of the mythtv user. So just run &#8220;env&#8221; to find the path and copy this script to somewhere in the path and give it execute rights and full permissions to themythtv user. I have tested this point and it does appears that &#8220;mythtvtv-setup&#8221; searches the path of the mythtv user.Also the filename must start with &#8220;tv_grab_&#8221; you can have what you want after that.<\/p>\n<p>Recently I have found that it worked for me to put it in the &#8220;HOME&#8221; folder for the user that runs mythbackend. In my case this was &#8220;\/var\/lib\/mythtv&#8221;<\/td>\n<\/tr>\n<tr>\n<td>5.<\/td>\n<td>Login to your MythTV backend server and login as the mythtv user. then start the &#8220;mythtv-setup&#8221;.<\/td>\n<\/tr>\n<tr>\n<td>6.<\/td>\n<td>\n<p style=\"text-align: center;\">Go to &#8220;Video Sources&#8221;<a  href=\"http:\/\/www.zoyinc.com\/wp-content\/uploads\/2014\/06\/mythtv_epg_3b.jpg\" class=\"thickbox no_icon\" title=\"MythTV Main Menu\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-1868\" src=\"http:\/\/www.zoyinc.com\/wp-content\/uploads\/2014\/06\/mythtv_epg_3b.jpg\" alt=\"MythTV Main Menu\" width=\"404\" height=\"217\" srcset=\"http:\/\/www.zoyinc.com\/wp-content\/uploads\/2014\/06\/mythtv_epg_3b.jpg 674w, http:\/\/www.zoyinc.com\/wp-content\/uploads\/2014\/06\/mythtv_epg_3b-150x80.jpg 150w, http:\/\/www.zoyinc.com\/wp-content\/uploads\/2014\/06\/mythtv_epg_3b-300x161.jpg 300w, http:\/\/www.zoyinc.com\/wp-content\/uploads\/2014\/06\/mythtv_epg_3b-500x268.jpg 500w\" sizes=\"auto, (max-width: 404px) 100vw, 404px\" \/><\/a><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>7.<\/td>\n<td>Then select or create your video source and edit it.<\/p>\n<p style=\"text-align: center;\"><a  href=\"http:\/\/www.zoyinc.com\/wp-content\/uploads\/2014\/06\/mythtv_epg_7b.jpg\" class=\"thickbox no_icon\" title=\"MythTV Video Sources\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-1869\" src=\"http:\/\/www.zoyinc.com\/wp-content\/uploads\/2014\/06\/mythtv_epg_7b.jpg\" alt=\"MythTV Video Sources\" width=\"204\" height=\"113\" srcset=\"http:\/\/www.zoyinc.com\/wp-content\/uploads\/2014\/06\/mythtv_epg_7b.jpg 292w, http:\/\/www.zoyinc.com\/wp-content\/uploads\/2014\/06\/mythtv_epg_7b-150x82.jpg 150w\" sizes=\"auto, (max-width: 204px) 100vw, 204px\" \/><\/a><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>8.<\/td>\n<td>\u00a0In the drop-down for &#8220;Listings grabber&#8221; you should select &#8220;New Zealand&#8221;:<a  href=\"http:\/\/www.zoyinc.com\/wp-content\/uploads\/2014\/06\/mythtv_epg_6c.jpg\" class=\"thickbox no_icon\" title=\"MythTV EPG\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-1875\" src=\"http:\/\/www.zoyinc.com\/wp-content\/uploads\/2014\/06\/mythtv_epg_6c.jpg\" alt=\"MythTV EPG\" width=\"480\" height=\"283\" srcset=\"http:\/\/www.zoyinc.com\/wp-content\/uploads\/2014\/06\/mythtv_epg_6c.jpg 800w, http:\/\/www.zoyinc.com\/wp-content\/uploads\/2014\/06\/mythtv_epg_6c-150x88.jpg 150w, http:\/\/www.zoyinc.com\/wp-content\/uploads\/2014\/06\/mythtv_epg_6c-300x177.jpg 300w, http:\/\/www.zoyinc.com\/wp-content\/uploads\/2014\/06\/mythtv_epg_6c-500x295.jpg 500w\" sizes=\"auto, (max-width: 480px) 100vw, 480px\" \/><\/a><\/td>\n<\/tr>\n<tr>\n<td>9.<\/td>\n<td>Next you need to create a config file in the home directory of the mythtv user. This needs to have exactly the same name as the &#8220;Video source name&#8221; you choose. In our case our source above is &#8220;HDHomeRun&#8221; so our config file is:<\/p>\n<p style=\"padding-left: 30px;\">~\/.mythtv\/HDHomeRun.xmltv<\/p>\n<p>I haven&#8217;t tested it but I suspect you need to get the capitalization correct too.<\/p>\n<p>There are a number of ways to do this.<\/p>\n<ol>\n<li>You can click on &#8220;Configure&#8221; in the above screenshot.<\/li>\n<li>You can run the &#8220;tv_grab_nz_py&#8221; script as the mythtv user<\/li>\n<li>You can create the config file manually.<\/li>\n<\/ol>\n<p>I did mine by running the script as the mythtv user. I tend to suspect creating the config file by hand might actually be the easiest, but then you need to know how to construct it.<\/p>\n<p>The &#8220;*.xmltv&#8221; is a list of channels. To give you an idea this is part of the contents of my HDHomeRun.xmltv:<\/p>\n<pre class=\"crayon:false;\">channel=aljazeera.freeviewnz.tv\r\nchannel=tv1.freeviewnz.tv\r\nchannel=tv-rotorua.freeviewnz.tv\r\nchannel=tv2.freeviewnz.tv\r\nchannel=tv2-plus1.freeviewnz.tv\r\nchannel=tv2-plus1.freeviewnz.tv\r\nchannel=tv3.freeviewnz.tv\r\nchannel=tv33.freeviewnz.tv\r\nchannel=tv3-plus1.freeviewnz.tv\r\nchannel=tv9.freeviewnz.tv\r\nchannel=tv-central.freeviewnz.tv\r\nchannel=tvnz7.freeviewnz.tv\r\nchannel=tv1-plus1.freeviewnz.tv\r\nchannel=tvsn-shopping-channel.freeviewnz.tv\r\nchannel=u.freeviewnz.tv<\/pre>\n<\/td>\n<\/tr>\n<tr>\n<td>10.<\/td>\n<td>Now you need to map the channels in the &#8220;tv_grab_nz_py&#8221; script with the channels that you receive from your terrestrial broadcast.<\/p>\n<p>So from the backend setup select &#8220;Channel Editor&#8221;:<\/p>\n<p style=\"text-align: center;\"><a  href=\"http:\/\/www.zoyinc.com\/wp-content\/uploads\/2014\/07\/mythtv_epg_13.jpg\" class=\"thickbox no_icon\" title=\"MythTV Channel Editor\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-1893\" src=\"http:\/\/www.zoyinc.com\/wp-content\/uploads\/2014\/07\/mythtv_epg_13.jpg\" alt=\"MythTV Channel Editor\" width=\"240\" height=\"173\" srcset=\"http:\/\/www.zoyinc.com\/wp-content\/uploads\/2014\/07\/mythtv_epg_13.jpg 400w, http:\/\/www.zoyinc.com\/wp-content\/uploads\/2014\/07\/mythtv_epg_13-150x108.jpg 150w, http:\/\/www.zoyinc.com\/wp-content\/uploads\/2014\/07\/mythtv_epg_13-300x216.jpg 300w\" sizes=\"auto, (max-width: 240px) 100vw, 240px\" \/><\/a><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>11.<\/td>\n<td>Once you are in the editor you should probably sort the list. Click on the &#8220;Sort Mode&#8221; input box and use the left and right arrows to select &#8220;Channel Number::<\/p>\n<p style=\"text-align: center;\"><a  href=\"http:\/\/www.zoyinc.com\/wp-content\/uploads\/2014\/07\/mythtv_epg_14.jpg\" class=\"thickbox no_icon\" title=\"MythTV Channel Editor Sort\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-1894\" src=\"http:\/\/www.zoyinc.com\/wp-content\/uploads\/2014\/07\/mythtv_epg_14.jpg\" alt=\"MythTV Channel Editor Sort\" width=\"350\" height=\"153\" srcset=\"http:\/\/www.zoyinc.com\/wp-content\/uploads\/2014\/07\/mythtv_epg_14.jpg 500w, http:\/\/www.zoyinc.com\/wp-content\/uploads\/2014\/07\/mythtv_epg_14-150x65.jpg 150w, http:\/\/www.zoyinc.com\/wp-content\/uploads\/2014\/07\/mythtv_epg_14-300x130.jpg 300w\" sizes=\"auto, (max-width: 350px) 100vw, 350px\" \/><\/a><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>12.<\/td>\n<td>Highlight the channel you wish to edit and push &#8220;Enter&#8221;:<a  href=\"http:\/\/www.zoyinc.com\/wp-content\/uploads\/2014\/07\/mythtv_epg_15.jpg\" class=\"thickbox no_icon\" title=\"MythTV Select Channel\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1895\" src=\"http:\/\/www.zoyinc.com\/wp-content\/uploads\/2014\/07\/mythtv_epg_15.jpg\" alt=\"MythTV Select Channel\" width=\"500\" height=\"313\" srcset=\"http:\/\/www.zoyinc.com\/wp-content\/uploads\/2014\/07\/mythtv_epg_15.jpg 500w, http:\/\/www.zoyinc.com\/wp-content\/uploads\/2014\/07\/mythtv_epg_15-150x93.jpg 150w, http:\/\/www.zoyinc.com\/wp-content\/uploads\/2014\/07\/mythtv_epg_15-300x187.jpg 300w, http:\/\/www.zoyinc.com\/wp-content\/uploads\/2014\/07\/mythtv_epg_15-479x300.jpg 479w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/a>As an aside one thing that eluded me for ages was how to delete one channel &#8211; simply select it and press &#8220;D&#8221;.<\/td>\n<\/tr>\n<tr>\n<td>13.<\/td>\n<td>Once you are in the &#8220;Channel Options | Common&#8221; screen look for the field &#8220;XMLTV ID&#8221; field. You need to edit this so it matches you &#8220;*.xmltv&#8221; file (in my case &#8220;HDHomeRun.xmltv&#8221;).So in the below example, I am editing the TV3 channel and in my &#8220;HDHomeRun.xmltv&#8221; file I have:<\/p>\n<pre class=\"crayon:false;\">channel=tv3.freeviewnz.tv<\/pre>\n<p style=\"text-align: left;\">\u00a0So you need to put in &#8220;tv3.freeviewnz.tv&#8221; as below:<\/p>\n<p style=\"text-align: left;\"><a  href=\"http:\/\/www.zoyinc.com\/wp-content\/uploads\/2014\/07\/mythtv_epg_16.jpg\" class=\"thickbox no_icon\" title=\"MythTV Edit A Channel Screen\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"http:\/\/www.zoyinc.com\/wp-content\/uploads\/2014\/07\/mythtv_epg_16.jpg\" alt=\"MythTV Edit A Channel Screen\" width=\"490\" height=\"289\" \/><\/a><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<h2>Troubleshooting<\/h2>\n<p>It&#8217;s really handy to run &#8220;mythfilldatabase&#8221; from a terminal and look at the output. For example if you see:<\/p>\n<pre class=\"crayon:false;\">No channels are configured to use grabber.<\/pre>\n<p>Then this means you have probably not edited the channels, as per the last few steps above or you have made a mistake in this area. Possibly the *.xmltv file is incorrect in some way.<\/p>\n<p>You may also see:<\/p>\n<pre class=\"crayon:false;\">Unknown xmltv channel identifier: c4.freeviewnz.tv - Skipping channel.<\/pre>\n<p>Which indicates that while &#8220;c4.freeviewnz.tv&#8221; exists in your *.xmltv file it is not configured in any of the channels in the channel editor.<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Recently we switched our MythTV system from using satellite to terrestrial reception using the HDHomeRun by SiliconDust. Unfortunately what had been a perfectly working EPG under satellite turned into a one day wonder under terrestrial &#8211; I could only see one days listing. I should point out that we live in New Zealand and the [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":873,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[18],"tags":[236,238,237,239,298,94,240],"class_list":["post-1843","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-mythtv","tag-channel","tag-electronic-program-guide","tag-epg","tag-listings","tag-mythtv","tag-setup","tag-tv-giuide"],"_links":{"self":[{"href":"http:\/\/www.zoyinc.com\/index.php?rest_route=\/wp\/v2\/posts\/1843","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.zoyinc.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.zoyinc.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.zoyinc.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/www.zoyinc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1843"}],"version-history":[{"count":36,"href":"http:\/\/www.zoyinc.com\/index.php?rest_route=\/wp\/v2\/posts\/1843\/revisions"}],"predecessor-version":[{"id":2679,"href":"http:\/\/www.zoyinc.com\/index.php?rest_route=\/wp\/v2\/posts\/1843\/revisions\/2679"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/www.zoyinc.com\/index.php?rest_route=\/wp\/v2\/media\/873"}],"wp:attachment":[{"href":"http:\/\/www.zoyinc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1843"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.zoyinc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1843"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.zoyinc.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1843"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}