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