File: cdda2mp3.new

package info (click to toggle)
cdrkit 9:1.1.11-3
  • links: PTS
  • area: main
  • in suites: bullseye, buster, jessie, jessie-kfreebsd, sid, stretch
  • size: 7,464 kB
  • sloc: ansic: 107,182; perl: 968; sh: 481; makefile: 229; sed: 4
file content (60 lines) | stat: -rw-r--r-- 1,691 bytes parent folder | download | duplicates (6)
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
#!/bin/sh
# Demo script for processing all audio tracks with a mp3 encoder
# This variant creates temporary wav files. There is another
# variant of this script (cdda2mp3), which uses a named pipe
# instead. This variant needs more disk space than the other one.
#
# usage: cdda2mp3.new <name prefix for all mp3 files>
#
# list_audio_tracks is a (symbolic) link to cdda2wav
# and used to generate a list of audio track numbers and start
# sectors, which in turn are used in a loop to spawn cdda2wav
# and the post processor on a track by track basis.

#
# feedback needed!!!!!!!!!!!!!!!!!
#

# specify the audio track listing program and its options
LAT=list_audio_tracks
LAT_OPTIONS=

# specify the sampling program and its options
# do not specify the track option here!
CDDA2WAV=cdda2wav
CDDA2WAV_OPTS='-Owav -H -P0 -q'

# for normal use, comment out the next line with a #
#DEBUG='-d1'

# specify the post processing program and its options
MP_CODER=l3enc
#MP_OPTIONS='2>/dev/null 1>/dev/null'
MP_OPTIONS='-br 128000'
#MP_OPTIONS='-hq'

WAVFILE=$$".wav"

FILEPREFIX=${1:-audiotrack}

# clean up wav file on exit, abort, ...
trap "rm -rf $WAVFILE" 0 2 3 4 6 7 8 10 11 12 13 15

# feed track numbers and start sectors into loop
$LAT $LAT_OPTIONS | while read TRACK STARTSECTOR;
do
  $CDDA2WAV $CDDA2WAV_OPTS -t$TRACK $DEBUG $WAVFILE 
#  echo n | $MP_CODER $WAVFILE $FILEPREFIX$TRACK.mp3 $MP_OPTIONS 
  $MP_CODER $WAVFILE $FILEPREFIX$TRACK.mp3 $MP_OPTIONS 

  # check result code
  RES=$?
  if [ $RES = 0 ] ; then
    echo File $FILEPREFIX$TRACK.mp3 finished successfully.
    rm $WAVFILE
  else
    echo File $FILEPREFIX$TRACK.mp3 failed \(result $RES\). Aborted. >&2
    break
  fi
done