Tuesday, March 24, 2009

MythTV plugin to watch Internet TV

If you have a mythTV box. You can simply make some minor modifications to it by creating a plugin which allows it to stream content from the web. This plugin simply contains URLs appropriately formatted to appear is mythTV menu items.

Following outlines the steps needed to build this plugin.

#!/usr/bin/perl -w
###########################################################
# File: online_movies.pl
#
# Download html from the following URL and parse for mms content and
# then build the online_movies.xml from it.
#
# 1. http://onlinevideochannel.blogspot.com/
###########################################################
use strict;
package OnlineMovies;
use base "HTML::Parser";
use Data::Dumper;

sub text {
my ($self,$text) = @_;
#print $text;
}

sub start {
my ($self, $tag, $attr, $attrseq, $origtext) = @_;
if ($tag eq "a"){
my $channel = $attr->{'channel'};
if( $channel ) {
my $href = $attr->{"href"};
print $channel,",",$href , "\n";
}
}
}

sub end {
my($self, $tag, $origtext) = @_;
#print $tag;
}

my $p = new OnlineMovies;
$p->parse_file("/tmp/index.html");
=====================================
Here's a Shell Script to process the downloaded HTML file and convert it into MythTV plugin:

wget -O /tmp/index.html http://onlinevideochannel.blogspot.com/
/home/mythtv/bin/online_movies.pl > /tmp/movie_urls.txt
cat /tmp/movie_urls.txt | awk '
BEGIN { FS = ",";
print "";
print "\t < button >";
print "\tRSYNC";
print "\t";
print "\t";
print "\t < /button > ";
};
{
if( NF > 0 ) {
print "\t < button >";
print "\tVIDEO_BROWSER";
printf ("\t\n", NR, $1);
printf ("\t\n",$2);
print "\t < /button >";
}
};
END {
print "
";
}
' > /usr/local/share/online_movies.xml

===================
Here's how to integrate this plugin into information menu:
add the following buttons to the /usr/local/share/mythtv/info_menu.xml


< button>
MOVIETIMES
Online Movies
MENU online_movies.xml
</button>
.
.


So you are all set....
Enjoy watching some hindi and English channels over the web.
The only caveat is that it takes time to buffer the content and the UI is frozen when this buffering is going on.

So I run this script as a cron job every night to get the latest channels from the online video blog which my wife maintains.

Tuesday, March 3, 2009

Choosing a hardware for MythTV DVR

There were three factors important for me in deciding the machine configuration to use:
1. I wanted a small form factor so that I could keep is next to my TV in the living room
2. I wanted wireless to work on it.
3. I wanted a remote to work with it.

If you want to record and watch programs later, you may additionally want a TV tuner card in your configuration. Setting up a TV tuner card is more involved and we will leave it for later.

We will start with very basic setup of the MythTV system and later on move to more involved improvements that can be done on it. So! lets define our basic fully functional system that we want to tackle in this blog:

Our basic fully functional MythTV device will be running MythTV frontend application will have capabilities to play music, videos, apple trailers, allow subscriptions to audio and video podcasts, allow checking local weather forecast, allow choosing slick skins, support wireless connection to network and will have a remote.

I recommend using StreamZap remote, which I really like. It is low price and works well with both Linux and Windows. I also recommend a dual boot system that can boot up in windows if required. So here are the things we need:

1. A PC, if it has a windows OS on it, we can convert it into a dual boot, if not, we can just make it Linux only OS.
2. Wireless: either external or internal. Alternatively one can use an Ethernet connection. If you have one close to where you want to keep this device.
3. Streamzap remove control.

So next blog we will talk about how to partition your hard disk for dual boot. I have used several strategies over the years and will stick to the best that I like. Please keep tuned.