3 # Build a database linking filenames to their numerical representations
4 # using a keypad for the DialAnMp3 application
7 $mp3dir="/usr/media/mpeg3";
9 dbmopen(%DIGITS, "/var/lib/asterisk/mp3list", 0644) || die("Unable to open mp3list");;
16 @entries = readdir(DIR
);
18 foreach $_ (@entries) {
25 $digits =~ s/[^ \w]+//g;
27 $digits =~ tr/[a-z]/[A-Z]/;
28 $digits =~ tr/[A-C]/2/;
29 $digits =~ tr/[D-F]/3/;
30 $digits =~ tr/[G-I]/4/;
31 $digits =~ tr/[J-L]/5/;
32 $digits =~ tr/[M-O]/6/;
33 $digits =~ tr/[P-S]/7/;
34 $digits =~ tr/[T-V]/8/;
35 $digits =~ tr/[W-Z]/9/;
37 print "File: $file, digits: $digits\n";
38 $DIGITS{$file} = $digits;