3 # a horribly funny script that shows how flexible udev can really be
4 # This is to be executed by udev with the following rules:
6 # KERNEL="hd*[!0-9]|sr*", PROGRAM="name_cdrom.pl $tempnode", SYMLINK+="%c"
11 use CDDB_get qw(get_cddb);
13 # following variables just need to be declared if different from defaults
15 $config{'CDDB_HOST'} = "freedb.freedb.org"; # set cddb host
16 $config{'CDDB_PORT'} = 8880; # set cddb port
17 $config{'CDDB_MODE'} = "cddb"; # set cddb mode: cddb or http
18 $config{'CD_DEVICE'} = $ARGV[0]; # set cd device
19 $config{'input'} = 0; # no user interaction
21 my %cd = get_cddb(\%config);
23 if (!defined $cd{title}) {
27 # print out our cd name
28 $cd{artist} =~ s/ /_/g;
29 $cd{title} =~ s/ /_/g;
30 print "$cd{artist}-$cd{title}\n";