nixfiles : ripperbot : rathole |
|
The proposed solution: load all the cds into a jukebox, and write a script that rotates them in and rips them, one by one. Consumer cd jukeboxes are becoming more common (and cheaper), so it seemed natural that someone would take a jukebox or changer mechanism and hook it up to a computer drive.
Surprisingly, there aren't many units like this available yet. The one I found was the PowerFile C200 Solo. This box holds 200 cds in a carousel, and has a single DVD-ROM drive that the cds can be swapped into. It uses a firewire (ieee 1394) interface to connect to a computer running windows. To the os it appears as two devices, a standard DVD-ROM device a custom device for the changer robot. The list price was $999, but I found one through yahoo shopping for $899.
Snags followed.
The changer came with "c200.ocx", which should be accessible from visual basic. From past experience I know that writing any kind of significant program in vb requires a higher pain threshold than mine. My first attempts to access c200.ocx were from perl, but perl turns out not to have very good activex scripting support. Tocx provides activex support for Tcl, but after fixing a few bugs it became clear that it was too incomplete. The scripting language of choice for this project appears to be python. Python has support for lots of win32 apis. Unfortunately they are sparsely documented and I have had to spend a lot of time in the python source code figuring out how things are supposed to work - but that's faster than writing them myself. I figure I need to learn this stuff anyway, since python is also the most rationally designed and implemented of the popular scripting languages and I'd like to get better with it.
Another possible approach at this point would have been to get off windows completely. I decided that reverse-engineering the changer control protocol for linux would probably take way too long. If I had known what was ahead I might have decided otherwise, but the python experience has been completely worth it.
Fortunately, the licensing protection for activex controls is extremely weak and well-documented on the web. The controlling application that came with the jukebox passes a magic string when it initializes the ocx; I watched the magic string go by and put it into C:\WINNT\system32\c200.lic.
Now comes the worst roadblock (so far): when I swap cds using my script, windows doesn't seem to notice that the cd in the drive has changed. Their driver software isn't signalling windows to re-read the drive, which would normally happen when a new cd is inserted into a cdrom drive. The explorer interface hides this brain damage because explorer is smart enough to scan for a new disc when reading it fails, but i don't know what explorer is doing. So I could circulate all the cds through the drive, but I couldn't actually read them without using the mouse. Aargh.
I gave up in disgust for a couple of months, occasionally skimming windows documentation to see if I could find anything new. Eventually I figured out the relevant DeviceIoControl call (and how to open the raw drive from python). The changer control part appears to be done.
The best aspi page I found is Bart's page about aspi.