<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://hurlster.com/wiki/index.php?action=history&amp;feed=atom&amp;title=Mythtv</id>
	<title>Mythtv - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://hurlster.com/wiki/index.php?action=history&amp;feed=atom&amp;title=Mythtv"/>
	<link rel="alternate" type="text/html" href="https://hurlster.com/wiki/index.php?title=Mythtv&amp;action=history"/>
	<updated>2026-10-10T09:10:05Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.38.4</generator>
	<entry>
		<id>https://hurlster.com/wiki/index.php?title=Mythtv&amp;diff=2529&amp;oldid=prev</id>
		<title>Gqwill69: /* Backend */</title>
		<link rel="alternate" type="text/html" href="https://hurlster.com/wiki/index.php?title=Mythtv&amp;diff=2529&amp;oldid=prev"/>
		<updated>2013-01-05T17:39:10Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Backend&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;XBMC based Mythtv installation guide (headless)&lt;br /&gt;
&lt;br /&gt;
== XBMC addon ==&lt;br /&gt;
 apt-get install xbmc-pvr-mythtv-cmyth &lt;br /&gt;
== Backend ==&lt;br /&gt;
 apt-get install mythtv-backend-master&lt;br /&gt;
&lt;br /&gt;
Fix mythweb&lt;br /&gt;
 a2dissite default-mythbuntu&lt;br /&gt;
 a2ensite default&lt;br /&gt;
 service apache2 reload&lt;br /&gt;
&lt;br /&gt;
Setup MythTV from remote Linux Desktop&lt;br /&gt;
 ssh -X username@&amp;#039;&amp;#039;xbmcservername&amp;#039;&amp;#039; /usr/bin/mythtv-setup&lt;br /&gt;
&lt;br /&gt;
== S-Video/Composite Input Recording ==&lt;br /&gt;
If you would like to be able to view or record input from either s-video or composite inputs on a PVR-x50 card, the following hack will allow you to do just that.&lt;br /&gt;
&lt;br /&gt;
Via mythtv-settings, do the following:&lt;br /&gt;
&lt;br /&gt;
1. Select &amp;quot;Video Sources,&amp;quot; then select &amp;quot;[New video source].&amp;quot; Name this source anything you like (Composite for our example) then set the &amp;quot;XMLTV listings grabber:&amp;quot; to &amp;quot;No grabber.&amp;quot; and select finish.&lt;br /&gt;
&lt;br /&gt;
2. Go into the &amp;quot;Channel Editor&amp;quot; then select &amp;quot;[New Channel].&amp;quot; Name this channel anything you like (Composite Input for our example), set the channel number to a channel that you do *not* have, then set the video source to be the source you just created (Composite for our example.) Select finish to continue.&lt;br /&gt;
&lt;br /&gt;
3. Select &amp;quot;Input Connections&amp;quot; from the main mythtv-settings screen and select your composite or s-video input. (For an example PVR-150 you might see &amp;quot;[MPEG : /dev/video0 ] {Composite 0} -&amp;gt; {None}.&amp;quot; Set the video source to be the source you created in step 1, and make sure that the starting channel is the channel that you created in step 2. Select finish and exit the settings.&lt;br /&gt;
&lt;br /&gt;
4. Start the backend then frontend, then change the channel to the new channel that you created. With nothing plugged in you should see a black screen. Connect an input device (VCR, camera, etc..) and you will then be able to see and record your video.&lt;br /&gt;
&lt;br /&gt;
== Channel Change via HTTP ==&lt;br /&gt;
Install directv_http.pl&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/perl&lt;br /&gt;
use LWP::UserAgent;&lt;br /&gt;
use JSON;&lt;br /&gt;
#use strict;&lt;br /&gt;
&lt;br /&gt;
# Get time for logging, if necessary&lt;br /&gt;
#($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time);&lt;br /&gt;
#$year = $year+1900;&lt;br /&gt;
#$mon = $mon+1;&lt;br /&gt;
$ua = LWP::UserAgent-&amp;gt;new;&lt;br /&gt;
$ua-&amp;gt;agent(&amp;quot;$0/0.1 &amp;quot; . $ua-&amp;gt;agent);&lt;br /&gt;
# $ua-&amp;gt;agent(&amp;quot;Mozilla/8.0&amp;quot;) # pretend we are very capable browser&lt;br /&gt;
&lt;br /&gt;
# If you want to log results of the channel change,&lt;br /&gt;
# uncomment the lines that look like:&lt;br /&gt;
## print MYFILE (&amp;quot;$year...&lt;br /&gt;
## close (MYFILE);&lt;br /&gt;
# As well as the lines at the beginning of this script that look like:&lt;br /&gt;
# Get time for logging, if necessary&lt;br /&gt;
## ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time);&lt;br /&gt;
## $year = $year+1900;&lt;br /&gt;
## $mon = $mon+1;&lt;br /&gt;
# As well as the file for logging below.  Change the path to something that&lt;br /&gt;
# makes sense...&lt;br /&gt;
#open (MYFILE, &amp;#039;&amp;gt;&amp;gt;/home/steve/Documents/dtvchangerdata.txt&amp;#039;);&lt;br /&gt;
&lt;br /&gt;
# get args&lt;br /&gt;
$dtv_ip = $ARGV[0];&lt;br /&gt;
$sleep_sec = $ARGV[1];&lt;br /&gt;
$arg = $ARGV[2];&lt;br /&gt;
$chan_num = &amp;quot;&amp;quot;;&lt;br /&gt;
$numArgs = $#ARGV + 1;&lt;br /&gt;
$tune = 1;&lt;br /&gt;
$minor = 0;&lt;br /&gt;
&lt;br /&gt;
if($numArgs == 0)&lt;br /&gt;
{&lt;br /&gt;
    print &amp;quot;(10) Error: no command line arguments\n&amp;quot;;&lt;br /&gt;
    exit 1;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
if($arg eq &amp;quot;getTuned&amp;quot;)&lt;br /&gt;
{&lt;br /&gt;
    $tune = 0;&lt;br /&gt;
}&lt;br /&gt;
elsif($arg eq &amp;quot;tune&amp;quot;)&lt;br /&gt;
{&lt;br /&gt;
    if(($ARGV[3] =~ m/-/) == 1)&lt;br /&gt;
    {&lt;br /&gt;
        @chan_arr = split(/-/, $ARGV[3]);&lt;br /&gt;
        $chan_num = $chan_arr[0];&lt;br /&gt;
        $minor = $chan_arr[1];&lt;br /&gt;
    }&lt;br /&gt;
    else&lt;br /&gt;
    {&lt;br /&gt;
        $chan_num = $ARGV[3];&lt;br /&gt;
    }&lt;br /&gt;
    $tune = 1;&lt;br /&gt;
}&lt;br /&gt;
else&lt;br /&gt;
{&lt;br /&gt;
    print &amp;quot;(20) Error: command line argument invalid\n&amp;quot;;&lt;br /&gt;
    exit 1;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
$url = &amp;#039;http://&amp;#039;.$dtv_ip.&amp;#039;:8080/tv/tune?major=&amp;#039;.$chan_num;&lt;br /&gt;
if($tune == 0)&lt;br /&gt;
{&lt;br /&gt;
    $url = &amp;#039;http://&amp;#039;.$dtv_ip.&amp;#039;:8080/tv/getTuned&amp;#039;;&lt;br /&gt;
}&lt;br /&gt;
if($minor != 0)&lt;br /&gt;
{&lt;br /&gt;
    $url = &amp;#039;http://&amp;#039;.$dtv_ip.&amp;#039;:8080/tv/tune?major=&amp;#039;.$chan_num.&amp;#039;&amp;amp;minor=&amp;#039;.$minor;&lt;br /&gt;
}&lt;br /&gt;
$req = HTTP::Request-&amp;gt;new(GET =&amp;gt; $url);&lt;br /&gt;
$req-&amp;gt;header(&amp;#039;Accept&amp;#039; =&amp;gt; &amp;#039;text/html&amp;#039;);&lt;br /&gt;
&lt;br /&gt;
$i = 0;&lt;br /&gt;
&lt;br /&gt;
while($i &amp;lt; 21)&lt;br /&gt;
{&lt;br /&gt;
    # send request&lt;br /&gt;
    $res = $ua-&amp;gt;request($req);&lt;br /&gt;
&lt;br /&gt;
    # check the outcome&lt;br /&gt;
    if ($res-&amp;gt;is_success) &lt;br /&gt;
    {&lt;br /&gt;
        #print $res-&amp;gt;content.&amp;quot;\n&amp;quot;;&lt;br /&gt;
        $json = new JSON;&lt;br /&gt;
        $json_text = $json-&amp;gt;decode($res-&amp;gt;content);&lt;br /&gt;
        $check_ok = $json_text-&amp;gt;{status}-&amp;gt;{msg};&lt;br /&gt;
        #print &amp;quot;OK? &amp;quot;.$check_ok . &amp;quot;\n&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
	if(index($check_ok,&amp;quot;OK&amp;quot;) != -1)        &lt;br /&gt;
	{&lt;br /&gt;
            if($tune == 0)&lt;br /&gt;
            {&lt;br /&gt;
                print $res-&amp;gt;content . &amp;quot;\n&amp;quot;;&lt;br /&gt;
            }&lt;br /&gt;
	    #print &amp;quot;Here 1\n&amp;quot;; &lt;br /&gt;
	    sleep $sleep_sec;&lt;br /&gt;
	    #print &amp;quot;Here 2\n&amp;quot;;         &lt;br /&gt;
	    #print MYFILE (&amp;quot;$year-$mon-$mday $hour:$min:$sec, chan $chan_num: $i failures\n&amp;quot;);&lt;br /&gt;
            #close (MYFILE);&lt;br /&gt;
            exit 0;&lt;br /&gt;
        }&lt;br /&gt;
        else&lt;br /&gt;
        {&lt;br /&gt;
            print &amp;quot;(30) Error: &amp;quot; . $check_ok . &amp;quot;\n&amp;quot;;&lt;br /&gt;
            #print MYFILE (&amp;quot;$year-$mon-$mday $hour:$min:$sec, chan $chan_num: $i failures, (30) Error &amp;quot;.$check_ok.&amp;quot;\n&amp;quot;);&lt;br /&gt;
            #close (MYFILE);&lt;br /&gt;
            exit 1;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    $i++; &lt;br /&gt;
&lt;br /&gt;
    if($i &amp;gt;= 20)&lt;br /&gt;
    {&lt;br /&gt;
        print &amp;quot;(40) Error: &amp;quot; . $res-&amp;gt;status_line . &amp;quot;\n&amp;quot;;&lt;br /&gt;
        #print MYFILE (&amp;quot;$year-$mon-$mday $hour:$min:$sec, chan $chan_num: $i failures, (40) Error &amp;quot;.$res-&amp;gt;status_line.&amp;quot;\n&amp;quot;);&lt;br /&gt;
        #close (MYFILE);&lt;br /&gt;
        exit 1;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
#print MYFILE (&amp;quot;$year-$mon-$mday $hour:$min:$sec, chan $chan_num: $i failures, How did I get here?\n&amp;quot;);&lt;br /&gt;
#close (MYFILE);&lt;br /&gt;
exit 1;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Under Video Sources, choose Svideo and insert the following command for channel changes.&lt;br /&gt;
 /usr/local/bin/directv_http.pl 192.168.0.5 1 tune&lt;br /&gt;
&lt;br /&gt;
== EPG ==&lt;br /&gt;
Download from host http://mc2xml.hosterbox.net/&lt;br /&gt;
 http://mc2xml.bigteo.net/?h=ouue51m&lt;br /&gt;
&lt;br /&gt;
How would I use mc2xml with MythTV?&lt;br /&gt;
&lt;br /&gt;
Create a directory and move mc2xml there&lt;br /&gt;
&lt;br /&gt;
 mkdir ~/mc2xml&lt;br /&gt;
 cd ~/mc2xml&lt;br /&gt;
 mv ~/downloads/mc2xml . &lt;br /&gt;
&lt;br /&gt;
Make mc2xml executable and run mc2xml with the &amp;quot;-c&amp;quot; and &amp;quot;-g&amp;quot; parameters to select and save a lineup to mc2xml.dat, and &lt;br /&gt;
update mythfilldatabase using the new xmltv.xml file&lt;br /&gt;
&lt;br /&gt;
 chmod 755 mc2xml&lt;br /&gt;
 ./mc2xml -c us -g 10000&lt;br /&gt;
 mythfilldatabase --refresh 14 --file --sourceid 1 --xmlfile ./xmltv.xml &lt;br /&gt;
&lt;br /&gt;
Disable mythfilldatabase from mythfrontend-&amp;gt;setup-&amp;gt;general&lt;br /&gt;
Set up a daily cron job to call a script that only updates mythfilldatabase if new tv data is available. (mc2xml returns 0 &lt;br /&gt;
when it updates, 1 when no new data is available). This example runs daily at 3:27 am.&lt;br /&gt;
&lt;br /&gt;
*/etc/crontab &lt;br /&gt;
 27 3 * * * user /home/user/mc2xml/update.sh&lt;br /&gt;
&lt;br /&gt;
*/home/mythtv/mc2xml/update.sh &lt;br /&gt;
 #!/bin/sh&lt;br /&gt;
 cd ~/mc2xml&lt;br /&gt;
 if ~/mc2xml/mc2xml ; then&lt;br /&gt;
     mythfilldatabase --refresh 14 --file --sourceid 1 --xmlfile ./xmltv.xml&lt;br /&gt;
 fi&lt;br /&gt;
Older versions of mythfilldatabase require different parameters &lt;br /&gt;
&lt;br /&gt;
From feedback: Mythfilldatabase loads the entire XMLTV file into RAM before entering it into the SQL database which can result in&lt;br /&gt;
swapping/slowness with large XMLTV files or on machines with limited RAM. You may want to split the xmltv file into smaller chunks &lt;br /&gt;
and import it in stages. Here is an example using tv_split from the xmltv package:&lt;br /&gt;
&lt;br /&gt;
 #!/bin/sh&lt;br /&gt;
 #split by day:&lt;br /&gt;
 nice tv_split xmltv.xml --output listings/%Y%m%d.xml&lt;br /&gt;
 #or split by channel for even smaller files:&lt;br /&gt;
 #nice tv_split xmltv.xml --output listings/%channel-%Y%m%d.xml&lt;br /&gt;
 for f in $( ls listings/ ); do&lt;br /&gt;
   nice mythfilldatabase --file --sourceid 1 --xmlfile listings/$f&lt;br /&gt;
   rm -f listings/$f&lt;br /&gt;
 done&lt;br /&gt;
[[Category:Linux]]&lt;/div&gt;</summary>
		<author><name>Gqwill69</name></author>
	</entry>
</feed>