CD TOC Reading in Mono

I had been getting bug reports that Banshee was not properly querying CDDB for track information on some discs. After some investigation, these discs turn out to be multi-session discs containing audio and data. It turns out that GStreamer (gstreamer-cdparanoia) does not generate a proper CDDB Disc ID, and even gives a warning about multi-session discs. That’s no good. Last night I set off to write a more direct approach to reading a CD’s Table of Contents.

I now have a mostly managed solution, using the Linux CD-ROM userspace kernel ioctls. However, the cdrom_tocentry struct for the CDROMREADTOCENTRY ioctl was a pain to marshal, so I added some C glue that will go in libbanshee. Ideally I’d like to marshal it and get rid of the glue. Obviously this will only work under Linux at the moment, but there should be no problem porting it to BSD et al. when necessary.

The important part is that the code generates proper TOC offsets for tracks, can calculate a proper CDDB Disc ID for plain audio and multi-session discs, and flags tracks as either audio or data, so the Banshee UI can hide the data tracks altogether.

For those interested, a standalone TOC reader is available. I’ll have this code merged in Banshee for the 0.9.8 release towards the end of the week.

Clearly, I am Missing Something

“Join the Race to Linux for a chance to win an xBox 360!” … what? Maybe misread that. Nope. I’m sorry, but that’s just a little ironic. Maybe they mean an xBox 360 pre-installed with Linux? No, probably not. I hope that’s not indicative of what may be product of the race. Oh well. May the winners win with Mono, and may they promptly sell their prize, or hack it to pieces – feel free to choose your own definition of ‘hack.’

It must be rocket science…

So I’m sitting here writing some generic “unhandled exception” code to display a dialog box in case Banshee throws up, as it’s better to have some kind of indication that it’s sick, than nothing at all. Along with the exception message and stack trace, I have it print the version information for all assemblies, and print the output of `uname -sirom` However one of the simplest, most useful pieces of platform information is the name and version of the distribution. Not the kernel version… the distribution release version. Like SuSE 10 Beta 3, or Ubuntu Breezy Preview Release 1, or Fedora Core 4. Something incredibly simple, yet meaningful. But how to find this out without doing some kind of insane file system fingerprinting or something else that is much more complicated than it should be?

Why isn’t there some simple static file, like /etc/distro, that contains a one line string of the distro name and version? Can it be too much to ask? Is there something simple that I’m missing? Am I the only developer that finds this information useful?

Actually, maybe some kind of Key=Value file, /etc/distro, could have more detailed, standard keys. Like Name=SuSE, Version=10.0, Release=Beta 3, Vendor=Novell, Kernel=Such and Such, etc., etc. Just so long as there’s some kind of standard distribution version file, with standard keys. I don’t care if it’s Key/Value, XML, Binary… just something with lots of useful information, that is standard across all distributions.

Oh well… the exception dialog rocks anyway.

GStreamer Voice Recorder in Mono

A few weeks ago Larry and I were talking about adding voice memos to photos in F-Spot. So last night, having trouble getting to sleep, I started hacking on a simple audio source recorder for GStreamer. I’ve now got a simple C “class” for recording to ogg, a Mono/C# binding class, and a Mono/C# test application. For those interested in trying it, here’s a tarball.

Though it’s really simple, I’m pretty excited about it because I can never seem to get the standalone Sound Recorder in GNOME to work properly. But maybe that’s just because I avoid it now out of past bad experiences. It probably works fine, and I’m just nuts.

I plan on adding basic playback and seeking to it, stealing a stripped down version of that code from Banshee (plug!), and then some how it will get integrated into F-Spot, so you can record all sorts of sentimental audio notes on your photos. How cute.

Oh well… back to Banshee.

I Just Want to Copy a CD!

It’s been over a month since my last entry, I think. I’ve intended to post something for a few weeks, but have been caught up in all things related to Banshee. Soon I’ll post some potentially interesting details regarding Banshee development. This post however, is for me to rant about CD Duplication in GNOME. Why is it such a difficult task?!

I haven’t needed to duplicate a CD for well over a year, or so that’s what my recollection says. So friend came over in desperate need of a copy of that other OS. My first reaction was laughter… I sure didn’t think I had a copy of that anywhere. After some digging through various dusty CD stacks however, I found a disk. Now to duplicate it: impossible. My first thought was to right click the disk in Nautilus, and select “Duplicate” or “Copy.” No such option. I then tried eroaster and xcdroast (ewwww): both don’t seem to like ATAPI at all, and insisted on SCSI emulation. I wasn’t going deal with that. It’s 2005. I was not going to stoop to the level of k3b either. Instead I hesitantly resorted to making an ISO with the ol’ trusty, but what should be completely unnecessary: dd if=/dev/hdc of=copy.iso. Once I had the ISO, Nautilus promptly offered to handle the later half of the chore and burn it to disk.

So we have had the “Burn ISO” feature in Nautilus for some time… why do we not have a “Copy Disk” option? The simple hack would be to write an ISO to a temp directory, and then use the Burn ISO feature to burn that temporary ISO. The better option would be to have CD->CD duplication (and maybe optionally CD->ISO->CD, as I can see CD->CD being an issue with some hardware). But we can at least easily do the ISO route.

Oh well, for now I’ve calmed down, and have a duplicated CD. But this is an issue I’d like to explore in the future, when I have solved the problem where an extra 5 hours is injected into the span of a day. I’ll give that task slightly higher priority.

Update: I take back 90% of this rant. Apparently the “Copy Disk” option is in the context menu for an optical drive in the Nautilus Computer window, but not on the Desktop context menu for the disk. So if the “Burn ISO” option is in both places… why isn’t the “Copy Disk” option?