{"id":259,"date":"2009-01-28T21:43:08","date_gmt":"2009-01-29T02:43:08","guid":{"rendered":"https:\/\/lowtek.ca\/roo\/?p=259"},"modified":"2009-01-28T21:43:08","modified_gmt":"2009-01-29T02:43:08","slug":"deleting-channels-from-mythtv","status":"publish","type":"post","link":"https:\/\/lowtek.ca\/roo\/2009\/deleting-channels-from-mythtv\/","title":{"rendered":"Deleting Channels From MythTV"},"content":{"rendered":"<p><a href=\"http:\/\/en.wikipedia.org\/wiki\/MythTV\">MythTV<\/a> is a DIY digital video recorder.\u00a0 Building a box to do this isn&#8217;t much beyond putting together a PC and installing Linux, but its not something I&#8217;d expect a non-geek to dive into.\u00a0 Geek or not &#8211; everyone should have some form of digital video recorder, it completely changes how you watch TV.<\/p>\n<p>Of course, since my MythBox is using a capture card to grab video from my sattellite receiver it has no idea what channel has which show.\u00a0 When I started with MythTV, there was a free service offered by Zap2It.com that offered up listing information in an easy to consume format.\u00a0 The listings provide MythTV with guide information so it knows what is on, and when.\u00a0 Today there is <a href=\"http:\/\/www.schedulesdirect.org\/\">SchedulesDirect<\/a> which is well run and inexpensive at $20 USD a year.<\/p>\n<p>Over time, channels change and this is reflected by changes in the listing data.\u00a0 MythTV detects these changes, and will add new channels automatically &#8211; it won&#8217;t remove channels that we listing information is no longer being delivered for.\u00a0 I&#8217;m on an older version (0.20) but suspect there is a design decision here.<\/p>\n<p>Using the UI to remove channels is pretty clunky.\u00a0 The MythTV site has<a href=\"http:\/\/www.mythtv.org\/docs\/mythtv-HOWTO-23.html#ss23.9\"> instructions on accomplishing this via the command line<\/a>, and while I&#8217;m comfortable with the command line &#8211; it is a multi-step process which I dreaded doing.\u00a0 So over a few months, more and more bogus channels that I didn&#8217;t actually have would get added.\u00a0 For example &#8211; a new pay per view (PPV) channel would appear, new guide data would become available and I&#8217;d start seeing it as an available channel&#8230; grr<\/p>\n<p>Of course, you still need to connect to SchedulesDirect and remove the unwanted channels from your subscription otherwise MythTV will just keep adding the &#8216;new&#8217; channels back.\u00a0 Tonight I wrote up a quick Perl script to automate the multi-step process &#8211; this makes removing unwanted channels quick and easy.<\/p>\n<p><strong><code>Usage: remove_channel.pl &lt;channel number&gt;<\/code><\/strong><\/p>\n<p><code><br \/>\n#!\/usr\/bin\/perl<\/p>\n<p>use Mysql;<\/p>\n<p># MYSQL CONFIG VARIABLES<br \/>\n$host = \"localhost\";<br \/>\n$database = \"mythconverg\";<br \/>\n$user = \"root\";<br \/>\n$pw = \"\";<\/p>\n<p># PERL MYSQL CONNECT()<br \/>\n$connect = Mysql-&gt;connect($host, $database, $user, $pw);<\/p>\n<p># SELECT DB<br \/>\n$connect-&gt;selectdb($database);<\/p>\n<p># DEFINE some MySQL queries<br \/>\n$findchan = \"SELECT chanid FROM channel where channum = \".$ARGV[0];<br \/>\n$delchannel = \"DELETE FROM channel where chanid = \";<br \/>\n$delprogram = \"DELETE FROM program where chanid = \";<\/p>\n<p># EXECUTE THE QUERY<br \/>\n$execute = $connect-&gt;query($findchan);<\/p>\n<p>while (@results = $execute-&gt;fetchrow()) {<br \/>\nprint \"chanid \".$results[0].\"\\n\";<br \/>\n$connect-&gt;query($delchannel.$results[0]);<br \/>\n$connect-&gt;query($delprogram.$results[0]);<br \/>\n}<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>MythTV is a DIY digital video recorder.\u00a0 Building a box to do this isn&#8217;t much beyond putting together a PC and installing Linux, but its not something I&#8217;d expect a non-geek to dive into.\u00a0 Geek or not &#8211; everyone should have some form of digital video recorder, it completely changes how you watch TV. Of &hellip; <a href=\"https:\/\/lowtek.ca\/roo\/2009\/deleting-channels-from-mythtv\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Deleting Channels From MythTV&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6,7,12],"tags":[],"class_list":["post-259","post","type-post","status-publish","format-standard","hentry","category-computing","category-diy","category-how-to"],"_links":{"self":[{"href":"https:\/\/lowtek.ca\/roo\/wp-json\/wp\/v2\/posts\/259","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lowtek.ca\/roo\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lowtek.ca\/roo\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lowtek.ca\/roo\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lowtek.ca\/roo\/wp-json\/wp\/v2\/comments?post=259"}],"version-history":[{"count":4,"href":"https:\/\/lowtek.ca\/roo\/wp-json\/wp\/v2\/posts\/259\/revisions"}],"predecessor-version":[{"id":263,"href":"https:\/\/lowtek.ca\/roo\/wp-json\/wp\/v2\/posts\/259\/revisions\/263"}],"wp:attachment":[{"href":"https:\/\/lowtek.ca\/roo\/wp-json\/wp\/v2\/media?parent=259"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lowtek.ca\/roo\/wp-json\/wp\/v2\/categories?post=259"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lowtek.ca\/roo\/wp-json\/wp\/v2\/tags?post=259"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}