Last change
on this file since 12 was
1,
checked in by peter, 13 years ago
|
initial import of current flacrip files into the trunk
|
-
Property svn:executable set to
*
|
File size:
1.2 KB
|
Line | |
---|
1 | #!/bin/bash |
---|
2 | |
---|
3 | # burn a CD from one or more FLAC files |
---|
4 | |
---|
5 | #TODO: option to do "cdrdao simulate" instead of "write"? |
---|
6 | COMMAND=write |
---|
7 | |
---|
8 | #TODO: option to normalize the wav files? |
---|
9 | |
---|
10 | if [ $# -eq 0 ]; then |
---|
11 | echo "Need at least one FLAC file" |
---|
12 | exit 127 |
---|
13 | fi |
---|
14 | |
---|
15 | # use a tmp dir for the cdda and toc files |
---|
16 | BURNFLAC_TMP=`mktemp -d -p /tmp burnflac.XXXXXX` |
---|
17 | #echo $BURNFLAC_TMP |
---|
18 | |
---|
19 | # counter for the wav files |
---|
20 | i=0 |
---|
21 | |
---|
22 | TOC_FILE="$BURNFLAC_TMP/cdda.toc" |
---|
23 | echo "CD_DA" > $TOC_FILE |
---|
24 | |
---|
25 | # shift off the arguments one by one |
---|
26 | while [ $# -gt 0 ]; do |
---|
27 | let i=$i+1 |
---|
28 | |
---|
29 | FLAC_FILE=$1 |
---|
30 | WAV_FILE="$BURNFLAC_TMP/cdda-$i.wav" |
---|
31 | |
---|
32 | shift |
---|
33 | |
---|
34 | if [ ! -r $FLAC_FILE ]; then |
---|
35 | echo "$FLAC_FILE not found" |
---|
36 | exit 192 |
---|
37 | fi |
---|
38 | |
---|
39 | CUESHEET=$(metaflac --export-cuesheet-to - $FLAC_FILE 2> /dev/null) |
---|
40 | |
---|
41 | if [[ -z $CUESHEET ]]; then |
---|
42 | # no cuesheet in the FLAC file |
---|
43 | # fake up a one-track TOC file |
---|
44 | cat <<END >> $TOC_FILE |
---|
45 | TRACK AUDIO |
---|
46 | FILE "$WAV_FILE" 0 |
---|
47 | END |
---|
48 | else |
---|
49 | # substitute the wav filename for the flac filename |
---|
50 | echo "$CUESHEET" \ |
---|
51 | | perl -pe'BEGIN { $wav = shift; } s/\".*?\" FLAC/$wav WAVE/' "$WAV_FILE" \ |
---|
52 | | cue2toc - \ |
---|
53 | | sed s/CD_DA// \ |
---|
54 | >> $TOC_FILE |
---|
55 | fi |
---|
56 | |
---|
57 | flac -d -o $WAV_FILE $FLAC_FILE |
---|
58 | |
---|
59 | done |
---|
60 | |
---|
61 | cdrdao $COMMAND --eject $TOC_FILE |
---|
62 | |
---|
63 | rm -rf $BURNFLAC_TMP |
---|
Note: See
TracBrowser
for help on using the repository browser.