K3B – Burn Baby Burn

At work, I primarily use a Windows based environment, but my home desktop is Ubuntu.  I did tinker for a while using Linux on my work laptop but found that the power management was temperamental and for my usage pattern the laptop has to sleep (and wake) predictably or its not useful.

Of course, my Ubuntu desktop isn’t the only machine at home.  Jenn’s got a Mac, and there are various Linux boxes and a host of other devices (squeezebox, etc) all on the network.  Really the network is much more important than the actual desktop you are using since mostly we’re talking about web and email access.  The network centric approach falls down when you want to do something like burn a DVD, then the machine matters.

Ubuntu comes with a nice set of built in tools  – but I wasn’t satisfied with the standard ones.  It didn’t take me long to come across K3B and I haven’t looked back since.  The user interface is intuitive, and I haven’t managed to make a coaster yet.

Just today I found myself needing to burn a Mac OSX .dmg file.  Now K3B doesn’t handle .dmg natively.  So the first thing we need to do is convert the .dmg file into an .iso ‘like’ file.  There was a handy thread that discussed exactly this problem and pointed at dmg2iso.pl.  The perl version works fine from my testing, but will fail with large .dmg files.  The solution is DMGExtractor, a java implementation that does the same conversion work.

Once you have converted the file – you might simply want to take a look at it without burning a CD or DVD.  This is easy under Linux.

sudo mount -t hfsplus -o loop test.iso /mnt

The same trick can be used with normal iso9660 format files by using -t iso9660 as the type.

Now its time to burn a DVD with our converted .iso like file.  K3B will dutifully check the format of this .iso file and report that it is not actually an iso9660 format file, but we know from mounting it that it is a valid filesystem in the hfsplus format.  K3B will let you still burn the DVD using this non-iso9660 file with a well worded warning that it can’t promise this will work but that there are valid formats that K3B doesn’t know about.

The resulting DVD works fine on the Mac – K3B hasn’t let me down yet.

When DNS Fails

Tonight I needed to do a bit of work as we’re coming up to a deadline and as usual things are running a bit behind. Normally I just VPN into work and use remote desktop to drive my desktop. Unfortunately when I went to do this tonight I wasn’t able to connect to my workstation via remote desktop.

A quick NSLookup query turned up the problem – it seems the DNS server at work had been reset and the DHCP lease for my workstation had not expired yet.  This means that the DNS server had no idea what IP my machine is using, but my workstation is under the assumption it has the rights to that IP address still.

Jim happened to be one of the few online, so I chatted with him a bit to see if he had any ideas how to resolve the problem.  He mentioned that this had happened to him a couple of times and his solution ended up being to drive back into work, I figured that would be my backup plan.

Jim then suggested using arp on a machine I had recently ssh‘d into from my workstation.  While I hadn’t actually used ssh to connect to any of our lab machines, it  got me thinking about our CVS server – as I was running Eclipse on my workstation and did have in theory an active connection.  From my laptop I was able to ssh into the CVS server, then using netstat I got a full list of the active connections.  Looking through the list turned up a few which were numeric (clearly where DNS had failed to provide a reverse name mapping).  From there it was a simple matter to remote desktop to the “right” numeric address to reach my workstation – I got lucky on my 1st try.

Deleting Channels From MythTV

MythTV is a DIY digital video recorder.  Building a box to do this isn’t much beyond putting together a PC and installing Linux, but its not something I’d expect a non-geek to dive into.  Geek or not – everyone should have some form of digital video recorder, it completely changes how you watch TV.

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.  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.  The listings provide MythTV with guide information so it knows what is on, and when.  Today there is SchedulesDirect which is well run and inexpensive at $20 USD a year.

Over time, channels change and this is reflected by changes in the listing data.  MythTV detects these changes, and will add new channels automatically – it won’t remove channels that we listing information is no longer being delivered for.  I’m on an older version (0.20) but suspect there is a design decision here.

Using the UI to remove channels is pretty clunky.  The MythTV site has instructions on accomplishing this via the command line, and while I’m comfortable with the command line – it is a multi-step process which I dreaded doing.  So over a few months, more and more bogus channels that I didn’t actually have would get added.  For example – a new pay per view (PPV) channel would appear, new guide data would become available and I’d start seeing it as an available channel… grr

Of course, you still need to connect to SchedulesDirect and remove the unwanted channels from your subscription otherwise MythTV will just keep adding the ‘new’ channels back.  Tonight I wrote up a quick Perl script to automate the multi-step process – this makes removing unwanted channels quick and easy.

Usage: remove_channel.pl <channel number>


#!/usr/bin/perl

use Mysql;

# MYSQL CONFIG VARIABLES
$host = "localhost";
$database = "mythconverg";
$user = "root";
$pw = "";

# PERL MYSQL CONNECT()
$connect = Mysql->connect($host, $database, $user, $pw);

# SELECT DB
$connect->selectdb($database);

# DEFINE some MySQL queries
$findchan = "SELECT chanid FROM channel where channum = ".$ARGV[0];
$delchannel = "DELETE FROM channel where chanid = ";
$delprogram = "DELETE FROM program where chanid = ";

# EXECUTE THE QUERY
$execute = $connect->query($findchan);

while (@results = $execute->fetchrow()) {
print "chanid ".$results[0]."\n";
$connect->query($delchannel.$results[0]);
$connect->query($delprogram.$results[0]);
}