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