summaryrefslogtreecommitdiffstats
path: root/cd2mp3
blob: ede06b0220d9b0b9a12a6458ee4798e84ca37bd9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/bin/sh

# Zurcher Jeremy

MYOPTS="-b 64 -q 7 --ty 2003"

cat <<EOF>lame_opts
BEGIN { out=""; }
/Tracknumber/ {
    match( \$0,/=.*/);
    S=substr(\$0,RSTART+2,RLENGTH-1);
    if( int(S)<10 ) {
        S="0"S;
    }
    out=out" --tn "S;
}
/Performer/ {
    match( \$0,/'.*/);
    S=substr(\$0,RSTART+1,RLENGTH-2);
    gsub(" ","_",S);
    out=out" --ta "S;
}
/Albumtitle/ {
    match( \$0,/'.*/);
    S=substr(\$0,RSTART+1,RLENGTH-2);
    gsub(" ","_",S);
    out=out" --tl "S;
}
/Tracktitle/ {
    match( \$0,/'.*/);
    S=substr(\$0,RSTART+1,RLENGTH-2);
    gsub(" ","_",S);
    out=out" --tt "S;
}
END { print out; }
EOF

cat <<EOF>build_name
BEGIN { out=""; }
/Tracknumber/ {
    match( \$0,/=.*/);
    S=substr(\$0,RSTART+2,RLENGTH-1);
    if( int(S)<10 ) {
        S="0"S;
    }
    out=S"_"out;
}
/Tracktitle/ {
    match( \$0,/'.*/);
    S=substr(\$0,RSTART+1,RLENGTH-2);
    gsub(" ","_",S);
    out=out""S;
}
END { print out; }
EOF
echo "cmd : sudo cdda2wav -v all -P 0 -n 75 -B -O wav dev=/dev/cdrom -L 1 || exit 1"
sudo cdda2wav -v all -P 0 -n 75 -B -O wav dev=/dev/cdrom -L 1 || exit 1
for I in audio*.wav; do
    INFO=`basename $I .wav`.inf
    NAME=`cat $INFO | awk -f ./build_name`
    LAMEOPTS=`cat $INFO | awk -f ./lame_opts`
    echo "cdm : lame $MYOPTS $LAMEOPTS $I $NAME.mp3"
    lame $MYOPTS $LAMEOPTS $I $NAME.mp3
done
rm -f lame_opts build_name audio*