Holger Amann keeney@fehu.org
CDDE is a tool for Linux which detects an inserted CD/DVD, scans it, tries to find various data or filesystem structures and then runs an application which can be defined by user in advance. At the moment CDDE is able to detect a blank medium, VCD, SVCD, DVD, Audio-CD, Data-CD/DVD.
This text describes how to install and configure CDDE. Then I'll showing an example how to get a nice Mac OS X like-behaviour also with KDE (or any other WM/DM). If you insert CDs/DVDs in Mac OS X, icons appear on the desktop, and ejecting CD/DVD with Apple Computers is only possible by a special key on the keyboard.
CDDE will not work with "Supermount" or other automounters! You have to disable them!
Get sure libxml is installed, my version is 1.8.17. Then download latest CDDE (0.2.0).
$ cd /usr/src $ su - $ wget http://ericlathrop.com/cdde/cdde-0.2.0.tar.gz $ tar xvzf cdde-0.2.0.tar.gz $ cd cdde-0.2.0 $ less README && less INSTALL $ ./configure && make && make install $ exit
After installation call cdde as user to get a template of the config-file
$ cdde Error: Config file /home/keeney/.cdde.xml does not exist! I created a template configuration file located at /home/keeney/.cdde.xml I suggest you edit it to make sure the values are useful before you run cdde again.
After editing .cdde.xml simply call cdde as user again. CDDE runs as a background process and at the moment it logs only to syslog, not to stderr for debugging. But the author mentioned that this would be fixed in the next release.
There could be other solutions, but here is mine:
<?xml version="1.0"?>
<cdde delay="500000">
<drive path="/dev/hdd">
<audio command="audiocd_cdde"/>
<data command="/usr/local/bin/mount_cdde dvd"/>
<dvd command="kfmclient exec /usr/local/bin/kaffeine_cdde_dvd"/>
<vcd command="kfmclient exec /usr/local/bin/kaffeine_cdde_vcd"/>
<svcd command="kfmclient exec /usr/local/bin/kaffeine_cdde_vcd"/>
<blank command="blank_cdde dvd"/>
<mixed command="/usr/local/bin/mount_cdde dvd"/>
</drive>
<drive path="/dev/hdc">
<audio command="mp3_cdde"/>
<data command="/usr/local/bin/mount_cdde cdrom"/>
<vcd command="/usr/local/bin/mount_cdde cdrom"/>
<svcd command="/usr/local/bin/mount_cdde cdrom"/>
<blank command="k3b_cdde"/>
<mixed command="/usr/local/bin/mount_cdde cdrom"/>
<drive>
</cdde>
I have two devices where /dev/hdd is a DVD-ROM and /dev/hdc a CD-RW. I created several scripts instead of calling programs directly and placed them under /usr/local/bin. For example audiocd_cdde:
#!/bin/sh
CMD=`pgrep -x xmms`
if [ -n "$CMD" ] ; then
pkill -f xmms
xmms -p /mnt/dvd
fi
Here audiocd_cdde looks for a running XMMS process and kills it when a new Audio-CD will be inserted.
Another example is "mount_cdde dvd" or "mount_cdde cdrom":
#!/bin/sh
ICONDIR=/home/keeney/tmp
DESTDIR=/home/keeney/Desktop
if [ "$1" = "dvd" ] ; then
kfmclient move $ICONDIR/DVD-ROM-Laufwerk $DESTDIR
kfmclient exec file:/home/keeney/Desktop/DVD-ROM-Laufwerk
fi
if [ "$1" = "cdrom" ] ; then
kfmclient move $ICONDIR/CD-Brenner $DESTDIR
kfmclient exec file:/home/keeney/Desktop/CD-Brenner
sleep 10
pkill -f kio_audiocd
fi
Now an icon appears on the desktop, KDE mounts the CD/DVD and starts konqueror. But beware, that icon must be created before, edited and moved to another directory, here ~/tmp. It's a standard KDE desktop device icon for CD/DVD devices. Create one, customise it (mountpoints etc.) and then move it to ~/tmp. Don't use only "cp" or "mv" because KDE would not realize that something is happend on the desktop unless you login again. KDE needs its own command "kfmclient", that's why I always used it.
There's a bug in KDE-3.3.2, where a process "kio_audiocd" locks a drive for a few minutes, also if a Data-CD is mounted, so it's not possible to eject it. In that script this process will be killed after 10 seconds. I hope this bug will be removed in the next version of KDE.
The next step is to allocate a key with a script to move back the icon(s) to ~/tmp and eject the drive(s). I used KHotKeys and created a new entry for each device called "eject_cdde_cdrom" and "eject_cdde_dvd" and bound them to keys "F11" and "F12".
$ cat /usr/local/bin/eject_cdde_cdrw #!/bin/sh DIR=/home/keeney ICON=/home/keeney/Desktop/CD-Brenner pkill -f audiocd:/MP3 eject /dev/hdc && if [ -e "$ICON" ]; then kfmclient move $ICON $DIR/tmp fi
By pushing the appropriate key the icon disappears, all processes which could lock the drive will be killed and the drive will be ejected.
That's it. Adapt the paths and commands for your needs. If something goes wrong, watch syslog and call your scripts manually. For questions about this doc please mail me.
Have fun!
| Holger Amann keeney@fehu.org |
|