|
Lines 1-84
Link Here
|
| 1 |
--- ripit.pl.orig Mon May 22 15:27:36 2000 |
1 |
--- ripit.pl.orig Sat Aug 25 18:20:06 2001 |
| 2 |
+++ ripit.pl Sun Sep 24 03:38:07 2000 |
2 |
+++ ripit.pl Wed Oct 3 21:50:36 2001 |
| 3 |
@@ -15,25 +15,32 @@ |
3 |
@@ -9,41 +9,49 @@ |
| 4 |
# --bitrate [rate] - Encode MP3 at this bitrate |
4 |
# Create an M3U file |
|
|
5 |
# |
| 6 |
# Options: |
| 7 |
-# [start_track] - rips from this track to last track |
| 8 |
-# --halt - powers off the machine when finished |
| 9 |
-# if your configuration supports it |
| 10 |
-# --bitrate [rate] - Encode MP3 at this bitrate |
| 11 |
+# [start_track] - rips from this track to last track |
| 12 |
+# --halt - powers off the machine when finished |
| 13 |
+# if your configuration supports it |
| 14 |
+# --bitrate [rate] - Encode MP3 at this bitrate |
| 5 |
# --year [year] - Tag MP3 with this year (included as CDDB |
15 |
# --year [year] - Tag MP3 with this year (included as CDDB |
| 6 |
# does not store this information) |
16 |
# does not store this information) |
| 7 |
-# --device - CDROM device to rip from |
17 |
-# --genre [genre] - Overrides CDDB genre, e.g. rock,funk |
| 8 |
+# --device - CDROM device to rip from |
18 |
-# --device [device] - CDROM device to rip from |
| 9 |
+# --numcpu - Number of parrallel encoders to run |
19 |
+# --genre [genre] - Overrides CDDB genre, e.g. rock,funk |
| 10 |
+# --outputdir - Directory in which to place MP3s |
20 |
+# --device [device] - CDROM device to rip from |
| 11 |
+# --cdripper - Which cdripper to use |
21 |
# --encopt [options] - Parameters to pass to encoder |
| 12 |
+# --encoder - Which encoder to use |
22 |
# --encoder [encoder] - Encoder to use, see below |
| 13 |
# |
23 |
# --cdripper [ripper] - Cdripper to use, see below |
| 14 |
# Version 1.8 22/05/00 - Simon Quinn |
24 |
# --cdopt [options] - Parameters to pass to cdripper |
| 15 |
# |
25 |
# --outputdir [dir] - Where MP3s should go |
| 16 |
# Usage: ripit.pl [--halt] [--bitrate rate] |
26 |
+# --numcpu [cpus] - Number of parallel encoders to run |
| 17 |
-# [--year year] [--device cddevice] [start_track] |
27 |
+# --auxdev [device] - Auxiliary CD-ROM device name. When using |
| 18 |
+# [--year year] [--device cddevice] [--numcpu cpus] |
28 |
+# cdda2wav with a SCSI device, use |
| 19 |
+# [--outputdir dir] [--cdripper ripper] [--encoder encoder] |
29 |
+# <bus>,<id>,<lun> for --device and e.g. |
| 20 |
+# [start_track] |
30 |
+# /dev/sr0 for --auxdev. The --auxdev value |
|
|
31 |
+# is given to CDDB_get.pm for CDDB lookup. |
| 32 |
# |
| 33 |
# Version 2.0 20/08/01 - Simon Quinn |
| 34 |
# |
| 35 |
# Usage: ripit.pl [--halt] [--bitrate rate] [--year year] [--genre genre] |
| 36 |
-# [--device cddevice] [--encopt options] [--encoder encoder] |
| 37 |
+# [--device cddevice] [--encopt options] [--encoder encoder] |
| 38 |
# [--cdripper cdripper] [--cdopt options] [--outputdir dir] |
| 39 |
-# [start_track] |
| 40 |
+# [--numcpu cpus] [start_track] |
| 21 |
#################################################################### |
41 |
#################################################################### |
| 22 |
# |
42 |
# |
| 23 |
# User configurable variables |
43 |
# User configurable variables |
| 24 |
# |
44 |
# |
| 25 |
|
45 |
|
| 26 |
$cddev = "/dev/cdrom"; # CD Audio device |
46 |
$cddev = "/dev/cdrom"; # CD Audio device |
| 27 |
-$outputdir = "/dosc/cdrip/"; # Where the MP3s should go |
47 |
-$outputdir = "/tmp/cdrip/"; # Where the MP3s should go, |
| 28 |
+$outputdir = "/dosc/cdrip"; # Where the MP3s should go |
48 |
- # must have trailing / |
|
|
49 |
+$cdauxdev = "/dev/sr0"; # Auxiliary CD-ROM device, when using |
| 50 |
+ # cdda2wav and SCSI devices |
| 51 |
+$outputdir = "/tmp/cdrip/"; # Where the MP3s should go |
| 29 |
$bitrate = 160; # Bitrate for MP3s |
52 |
$bitrate = 160; # Bitrate for MP3s |
| 30 |
$encoder = 1; # 0 - Bladeenc, 1 - Lame, 2 - Gogo |
53 |
-$encoder = 0; # 0 - Lame, 1 - OggVorbis |
|
|
54 |
+$encoder = 0; # 0 - Lame, 1 - Gogo, 2 - OggVorbis |
| 31 |
$encopt = ""; # options for mp3 encoder |
55 |
$encopt = ""; # options for mp3 encoder |
| 32 |
$cdripper = 0; # 0 - cdparanoia, 1 - cdda2wav, |
56 |
$cdripper = 0; # 0 - dagrab, |
| 33 |
- # 2 - tosha, 3 - cdd |
57 |
# 1 - cdparanoia, 2 - cdda2wav, |
| 34 |
+ # 2 - tosha, 3 - cdd, 4 - dagrab |
58 |
# 3 - tosha, 4 - cdd |
| 35 |
$cdopt = ""; # options for cdaudio ripper |
59 |
$cdopt = ""; # options for cdaudio ripper |
| 36 |
+$numcpu = 1; # Number of parallel encoders to run |
60 |
+$numcpu = 1; # Number of parallel encoders to run |
| 37 |
|
61 |
|
| 38 |
$use_underscore = 0; # Use _ instead of spaces in filenames (1 yes, 0 no) |
62 |
$CDDB_HOST = "freedb.freedb.org"; # set cddb host |
| 39 |
|
63 |
$CDDB_PORT = 8880; # set cddb port |
| 40 |
@@ -53,6 +60,9 @@ |
64 |
@@ -77,6 +85,9 @@ |
| 41 |
require "flush.pl"; |
65 |
$nocddbinfo = 1; # Assume no CDDB info exists |
| 42 |
use Getopt::Long; |
66 |
$trackselection = ""; # Passed from command line |
| 43 |
|
67 |
|
| 44 |
+$ripper_died = 0; |
68 |
+$ripper_died = 0; |
| 45 |
+$SIG{HUP} = \&catch_hup; |
69 |
+$SIG{HUP} = \$catch_hup; |
| 46 |
+ |
70 |
+ |
| 47 |
# Initialise global variables |
71 |
#################################################### |
| 48 |
# |
72 |
# Do the following: |
| 49 |
$year = ""; # Year of Audio CD - written to MP3 tag |
73 |
# 1. Get command line parameters |
| 50 |
@@ -75,9 +85,19 @@ |
74 |
@@ -90,19 +101,25 @@ |
|
|
75 |
|
| 76 |
# Get the parameters from the command line |
| 51 |
if ( ! &GetOptions("halt" => \$haltonfinish, |
77 |
if ( ! &GetOptions("halt" => \$haltonfinish, |
| 52 |
"bitrate=i" => \$bitrate, |
78 |
- "bitrate=i" => \$bitrate, |
| 53 |
"year=i" => \$year, |
79 |
- "year=i" => \$year, |
| 54 |
- "device=s" => \$cddev) ) { |
80 |
- "genre=s" => \$genre, |
| 55 |
+ "device=s" => \$cddev, |
81 |
- "device=s" => \$cddev, |
| 56 |
+ "numcpu=i" => \$numcpu, |
82 |
- "encopt=s" => \$encopt, |
| 57 |
+ "outputdir=s" => \$outputdir, |
83 |
- "encoder=i" => \$encoder, |
| 58 |
+ "cdripper=i" => \$cdripper, |
84 |
- "cdripper=i" => \$cdripper, |
| 59 |
+ "cdopt=s" => \$cdopt, |
85 |
- "cdopt=s" => \$cdopt, |
| 60 |
+ "encoder=i" => \$encoder, |
86 |
- "outputdir=s" => \$outputdir ) ) { |
| 61 |
+ "encopt=s" => \$encopt) ) { |
87 |
- print "Usage: ripit.pl [--halt] [--bitrate rate] [--year year] |
| 62 |
print "Usage: ripit.pl [--halt] [--bitrate rate] [--year year] |
88 |
+ "bitrate=i" => \$bitrate, |
| 63 |
- [--device cddevice] [start_track]\n"; |
89 |
+ "year=i" => \$year, |
| 64 |
+ [--device cddevice] [--numcpu cpus] [--outputdir dir] |
90 |
+ "genre=s" => \$genre, |
| 65 |
+ [--cdripper cdripper] [--encoder encoder] [start_track] |
91 |
+ "device=s" => \$cddev, |
| 66 |
+ CD Rippers: 0 - cdparanoia, 1 - cdda2wav, 2 - tosha, 3 - cdd, 4 - dagrab |
92 |
+ "encopt=s" => \$encopt, |
| 67 |
+ Encoders: 0 - Bladeenc, 1 - Lame, 2 - Gogo\n"; |
93 |
+ "encoder=i" => \$encoder, |
| 68 |
+ |
94 |
+ "cdripper=i" => \$cdripper, |
|
|
95 |
+ "cdopt=s" => \$cdopt, |
| 96 |
+ "outputdir=s" => \$outputdir, |
| 97 |
+ "numcpu=i" => \$numcpu, |
| 98 |
+ "auxdev=s" => \$cdauxdev) ) { |
| 99 |
+ print " |
| 100 |
+Usage: ripit.pl [--halt] [--bitrate rate] [--year year] [--genre genre] |
| 101 |
[--device cddevice] [--encopt options] [--encoder encoder] |
| 102 |
[--cdripper cdripper] [--cdopt options] [--outputdir dir] |
| 103 |
- [start_track]\n"; |
| 104 |
+ [--numcpu cpus] [--auxdev cddevice] [start_track] |
| 105 |
+Rippers: 0 - dagrab, 1 - cdparanoia, 2 - cdda2wav, 3 - tosha, 4 - cdd |
| 106 |
+Encoders: 0 - Lame, 1 - Gogo, 2 - OggVorbis |
| 107 |
+"; |
| 69 |
exit 1; |
108 |
exit 1; |
| 70 |
} |
109 |
} |
| 71 |
|
110 |
|
| 72 |
@@ -113,7 +133,7 @@ |
111 |
@@ -112,6 +129,9 @@ |
|
|
112 |
|
| 113 |
if ($haltonfinish == 1) {print "Will halt machine when finished.\n";} |
| 114 |
|
| 115 |
+# Robustify outputdir by adding trailing slash if not already there |
| 116 |
+$outputdir .= "/" unless $outputdir =~ /\/$/; |
| 117 |
+ |
| 118 |
# Get starting track parameter if it has been given |
| 119 |
if ($ARGV[0] ne '') { |
| 120 |
$trackselection = $ARGV[0]; |
| 121 |
@@ -132,8 +152,8 @@ |
| 122 |
&create_dirs(); # Create directories MP3 files |
| 73 |
&rip_cd(); # Rip, Encode & Tag |
123 |
&rip_cd(); # Rip, Encode & Tag |
| 74 |
|
124 |
|
| 75 |
print "Waiting for MP3 Encoder to finish...\n"; |
125 |
-print "Waiting for MP3 Encoder to finish...\n"; |
| 76 |
-wait; |
126 |
-wait; |
| 77 |
+while (wait != -1) {}; |
127 |
+print "Waiting for MP3 Encoder(s) to finish...\n"; |
|
|
128 |
+while (wait != -1) {}; |
| 78 |
|
129 |
|
| 79 |
&create_m3u(); # Create the M3U file for the MP3 files |
130 |
&create_m3u(); # Create the M3U file for the MP3 files |
| 80 |
|
131 |
|
| 81 |
@@ -137,6 +157,10 @@ |
132 |
@@ -157,6 +177,10 @@ |
| 82 |
|
133 |
|
| 83 |
exit; |
134 |
exit; |
| 84 |
|
135 |
|
|
Lines 89-104
Link Here
|
| 89 |
# |
140 |
# |
| 90 |
# Create the track selection from the parameters passed |
141 |
# Create the track selection from the parameters passed |
| 91 |
# on the command line |
142 |
# on the command line |
| 92 |
@@ -286,7 +310,7 @@ |
143 |
@@ -208,7 +232,13 @@ |
| 93 |
# Directory created will be: /outputdir/Artist - Album/ |
144 |
$config{CDDB_HOST} = $CDDB_HOST; |
| 94 |
# The value must end in / |
145 |
$config{CDDB_PORT} = $CDDB_PORT; |
|
|
146 |
$config{CDDB_MODE} = $CDDB_MODE; |
| 147 |
- $config{CD_DEVICE} = $cddev; |
| 148 |
+ # CD device for CDDB lookup needs special care when using cdda2wav with |
| 149 |
+ # a SCSI device. See the usage comment in the top of the file. |
| 150 |
+ if ($cdripper == 2 && $cddev =~ /^[0-9]+,[0-9]+,[0-9]+$/) { |
| 151 |
+ $config{CD_DEVICE} = $cdauxdev; |
| 152 |
+ } else { |
| 153 |
+ $config{CD_DEVICE} = $cddev; |
| 154 |
+ } |
| 155 |
$config{input} = $CDDB_INPUT; |
| 95 |
|
156 |
|
| 96 |
- $mp3dir = $outputdir.$artist." - ".$album."/"; |
157 |
my %cd=get_cddb(\%config); # Get CD TOC from CDDB_get |
| 97 |
+ $mp3dir = $outputdir."/".$artist." - ".$album."/"; |
158 |
@@ -241,9 +271,14 @@ |
|
|
159 |
} |
| 98 |
|
160 |
|
| 99 |
if ($use_underscore == 1) { $mp3dir =~ s/ /_/g; } |
161 |
if($genre ne "") { |
|
|
162 |
- if(system("lame --genre-list | grep -i \"$genre\" >/dev/null 2>&1")) { |
| 163 |
- die "Genre $genre is invalid!"; |
| 164 |
- } |
| 165 |
+ if(system("mp3info -G | grep -i \"[0-9] $genre [^a-z0-9&+/-]\" >/dev/null 2>&1")) { |
| 166 |
+ print "Genre $genre is invalid! Using 'Unknown' as genre."; |
| 167 |
+ $genre = 'Unknown'; |
| 168 |
+ # We do the above instead of dying, since the genre validity |
| 169 |
+ # check is a bit fragile. It works with mp3info-0.8.4, but breaks |
| 170 |
+ # with at least some earlier versions and possibly with future |
| 171 |
+ # ones. <oyvindmo@initio.no> |
| 172 |
+ } |
| 173 |
} |
| 100 |
|
174 |
|
| 101 |
@@ -340,24 +364,29 @@ |
175 |
print "\nCD TOC\n"; |
|
|
176 |
@@ -336,31 +371,37 @@ |
| 102 |
$riptrackname = &get_trackname($_, $tracklist[$_ - 1]); |
177 |
$riptrackname = &get_trackname($_, $tracklist[$_ - 1]); |
| 103 |
$riptrackno = $_; |
178 |
$riptrackno = $_; |
| 104 |
|
179 |
|
|
Lines 108-173
Link Here
|
| 108 |
|
183 |
|
| 109 |
# Choose the cdaudio ripper to use |
184 |
# Choose the cdaudio ripper to use |
| 110 |
if ($cdripper == 0) { |
185 |
if ($cdripper == 0) { |
|
|
186 |
if (system("dagrab -d $cddev -v $cdopt -f \"$riptrackname.rip\" $riptrackno")) { |
| 187 |
- &printflush(RIPLOG,"cdparanoia failed on $tracklist[$_ - 1]\n"); |
| 188 |
+ &printflush(RIPLOG,"dagrab failed on $tracklist[$_ - 1]\n"); |
| 189 |
+ kill 1, @encoders; |
| 190 |
die "dagrab failed on $tracklist[$_ - 1]"; |
| 191 |
} |
| 192 |
} |
| 193 |
elsif ($cdripper == 1) { |
| 111 |
if (system("cdparanoia -d $cddev $cdopt $riptrackno \"$riptrackname.rip\"")) { |
194 |
if (system("cdparanoia -d $cddev $cdopt $riptrackno \"$riptrackname.rip\"")) { |
| 112 |
&printflush(RIPLOG,"cdparanoia failed on $tracklist[$_ - 1]\n"); |
195 |
&printflush(RIPLOG,"cdparanoia failed on $tracklist[$_ - 1]\n"); |
| 113 |
+ kill 1, @encoders; |
196 |
+ kill 1, @encoders; |
| 114 |
die "cdparanoia failed on $tracklist[$_ - 1]"; |
197 |
die "cdparanoia failed on $tracklist[$_ - 1]"; |
| 115 |
} |
198 |
} |
| 116 |
} |
199 |
} |
| 117 |
elsif ($cdripper == 1) { |
200 |
elsif ($cdripper == 2) { |
| 118 |
- if (system("cdda2wav -D $cddev -Q -H $cdopt -t $riptrackno \"$riptrackname.rip\"")) { |
201 |
- if (system("cdda2wav -D $cddev -Q -H $cdopt -t $riptrackno \"$riptrackname.rip\"")) { |
| 119 |
+ if (system("cdda2wav -D $cddev -q -Q -H $cdopt -t $riptrackno - > \"$riptrackname.rip\"")) { |
202 |
+ if (system("cdda2wav -D $cddev -q -Q -H $cdopt -t $riptrackno \"$riptrackname.rip\"")) { |
| 120 |
&printflush(RIPLOG,"cdda2wav failed on $tracklist[$_ - 1]\n"); |
203 |
&printflush(RIPLOG,"cdda2wav failed on $tracklist[$_ - 1]\n"); |
| 121 |
+ kill 1, @encoders; |
204 |
+ kill 1, @encoders; |
| 122 |
die "cdda2wav failed on $tracklist[$_ - 1]"; |
205 |
die "cdda2wav failed on $tracklist[$_ - 1]"; |
| 123 |
} |
206 |
} |
| 124 |
} |
207 |
} |
| 125 |
elsif ($cdripper == 2) { |
208 |
elsif ($cdripper == 3) { |
| 126 |
if (system("tosha -d $cddev -f wav -t $riptrackno -o \"$riptrackname.rip\"")) { |
209 |
if (system("tosha -d $cddev -f wav -t $riptrackno -o \"$riptrackname.rip\"")) { |
| 127 |
&printflush(RIPLOG,"tosha failed on $tracklist[$_ - 1]\n"); |
210 |
- &printflush(RIPLOG,"tosha failed on $tracklist[$_ - 1]\n"); |
| 128 |
+ kill 1, @encoders; |
211 |
- die "tosha failed on $tracklist[$_ - 1]"; |
| 129 |
die "tosha failed on $tracklist[$_ - 1]"; |
212 |
+ &printflush(RIPLOG,"tosha failed on $tracklist[$_ - 1]\n"); |
|
|
213 |
+ kill 1, @encoders; |
| 214 |
+ die "tosha failed on $tracklist[$_ - 1]"; |
| 130 |
} |
215 |
} |
| 131 |
} |
216 |
} |
| 132 |
@@ -370,6 +399,13 @@ |
217 |
elsif ($cdripper == 4) { |
|
|
218 |
@@ -369,6 +410,7 @@ |
| 219 |
$cdd_dev =~ s/c$//; |
| 220 |
if (system("cdd -t $riptrackno -q -f $cdd_dev - 2>/dev/null | sox -t cdr -x - \"$riptrackname.rip\"")) { |
| 221 |
&printflush(RIPLOG,"cdd failed on $tracklist[$_ - 1]\n"); |
| 222 |
+ kill 1, @encoders; |
| 133 |
die "cdd failed on $tracklist[$_ - 1]"; |
223 |
die "cdd failed on $tracklist[$_ - 1]"; |
| 134 |
} |
224 |
} |
| 135 |
} |
225 |
} |
| 136 |
+ elsif ($cdripper == 4) { |
226 |
@@ -381,11 +423,13 @@ |
| 137 |
+ if (system("dagrab -d $cddev -f \"$riptrackname.rip\" $riptrackno")) { |
|
|
| 138 |
+ &printflush(RIPLOG,"dagrab failed on $tracklist[$_ - 1]\n"); |
| 139 |
+ kill 1, @encoders; |
| 140 |
+ die "dagrab failed on $tracklist[$_ - 1]"; |
| 141 |
+ } |
| 142 |
+ } |
| 143 |
else { |
| 144 |
die "No CD Ripper defined"; |
| 145 |
} |
| 146 |
@@ -379,11 +415,13 @@ |
| 147 |
rename "$riptrackname.rip","$riptrackname.wav"; |
227 |
rename "$riptrackname.rip","$riptrackname.wav"; |
| 148 |
|
228 |
|
| 149 |
&printflush(RIPLOG,"Rip complete $tracklist[$_ - 1]\n"); |
229 |
&printflush(RIPLOG,"Rip complete $tracklist[$_ - 1]\n"); |
| 150 |
+ } |
230 |
+ } |
| 151 |
|
231 |
|
| 152 |
# Start the Encoder in the background. but only once |
232 |
- # Start the Encoder in the background. but only once |
| 153 |
- if ($startenc == 0) { |
233 |
- if ($startenc == 0) { |
| 154 |
- $startenc = 1; |
234 |
- $startenc = 1; |
| 155 |
- unless (fork) { &enc_cd(); } |
235 |
- unless (fork) { &enc_cd(); } |
|
|
236 |
+ # Start the Encoder in the background. but only once per CPU |
| 156 |
+ if ($startenc < $numcpu) { |
237 |
+ if ($startenc < $numcpu) { |
| 157 |
+ sleep $startenc*5; |
238 |
+ sleep $startenc * 5; |
| 158 |
+ $startenc = $startenc + 1; |
239 |
+ $startenc = $startenc + 1; |
| 159 |
+ unless ($encoders[$startenc]=fork) { &enc_cd(); } |
240 |
+ unless ($encoders[$startenc]=fork) { &enc_cd(); } |
| 160 |
} |
241 |
} |
| 161 |
|
242 |
|
| 162 |
} |
243 |
} |
| 163 |
@@ -399,24 +437,25 @@ |
244 |
@@ -407,25 +451,33 @@ |
| 164 |
sub enc_cd { |
245 |
$riptrackno = $_; |
| 165 |
my($i,$x,$ncount,$enc); |
|
|
| 166 |
|
| 167 |
- |
| 168 |
foreach (@seltrack) { |
| 169 |
|
| 170 |
$riptrackname = &get_trackname($_, $tracklist[$_ - 1]); |
| 171 |
$ncount++; |
246 |
$ncount++; |
| 172 |
|
247 |
|
| 173 |
- print "\nMP3 Encoding track ".$ncount." of ".($#seltrack + 1)."\n"; |
248 |
- print "\nMP3 Encoding track ".$ncount." of ".($#seltrack + 1)."\n"; |
|
Lines 180-186
Link Here
|
| 180 |
+ while( ! -r "$riptrackname.wav" && ! -r "$riptrackname.mp3" ){ |
255 |
+ while( ! -r "$riptrackname.wav" && ! -r "$riptrackname.mp3" ){ |
| 181 |
$x++; |
256 |
$x++; |
| 182 |
if ($x > 179) { die "MP3 encoder waited 30 minutes before giving up"; } |
257 |
if ($x > 179) { die "MP3 encoder waited 30 minutes before giving up"; } |
| 183 |
+ if ($ripper_died) { die "CD Ripper seems to have died - exiting"; } |
258 |
+ if ($ripper_died) { die "CD Ripper seems to have died - exiting"; } |
| 184 |
sleep 10; |
259 |
sleep 10; |
| 185 |
} |
260 |
} |
| 186 |
|
261 |
|
|
Lines 190-220
Link Here
|
| 190 |
+ |
265 |
+ |
| 191 |
# Set the encoder we are going to use |
266 |
# Set the encoder we are going to use |
| 192 |
if ($encoder == 0) { |
267 |
if ($encoder == 0) { |
| 193 |
$enc = "bladeenc $encopt -QUIT -$bitrate \"$riptrackname.wav\" "; |
268 |
$enc = "lame $encopt -S -b $bitrate --tt \"$tracklist[$_ - 1]\" --ta \"$artist\" --tl \"$album\" --ty \"$year\" --tg \"$genre\" --tn $riptrackno --add-id3v2 \"$riptrackname.wav\" \"$riptrackname.mp3\""; |
| 194 |
@@ -427,6 +466,9 @@ |
269 |
} |
| 195 |
elsif ($encoder == 2) { |
270 |
elsif ($encoder == 1) { |
| 196 |
$enc = "gogo \"$riptrackname.wav\" \"$riptrackname.mp3\" $encopt -b $bitrate"; |
271 |
+ $enc = "gogo \"$riptrackname.wav\" \"$riptrackname.mp3\" $encopt -b $bitrate"; |
|
|
272 |
+ } |
| 273 |
+ elsif ($encoder == 2) { |
| 274 |
$enc = "oggenc $encopt -b $bitrate -t \"$tracklist[$_ - 1]\" -a \"$artist\" -l \"$album\" -d \"$year\" -N $riptrackno -o \"$riptrackname.ogg\" \"$riptrackname.wav\""; |
| 197 |
} |
275 |
} |
| 198 |
+ else { |
276 |
+ else { |
| 199 |
+ die "No Encoder defined"; |
277 |
+ die "No encoder defined"; |
| 200 |
+ } |
278 |
+ } |
| 201 |
|
279 |
|
| 202 |
if ( ! system("$enc >$enclog 2>&1 </dev/null")) { |
280 |
if ( ! system("$enc >$enclog 2>&1 </dev/null")) { |
| 203 |
|
281 |
|
| 204 |
@@ -443,6 +485,7 @@ |
282 |
@@ -438,7 +490,8 @@ |
| 205 |
&printflush(RIPLOG,"MP3 Encoder Failed on $tracklist[$_ - 1]\n"); |
283 |
&printflush(RIPLOG,"MP3 Encoder Failed on $tracklist[$_ - 1]\n"); |
| 206 |
die "MP3 Encoder Failed on $tracklist[$_ - 1]"; |
284 |
die "MP3 Encoder Failed on $tracklist[$_ - 1]"; |
| 207 |
} |
285 |
} |
|
|
286 |
- |
| 208 |
+ } |
287 |
+ } |
| 209 |
|
288 |
+ |
| 210 |
} |
289 |
} |
| 211 |
exit ; |
290 |
exit ; |
| 212 |
@@ -457,7 +500,7 @@ |
291 |
} |
|
|
292 |
@@ -452,10 +505,18 @@ |
| 213 |
$file="$artist.m3u"; |
293 |
$file="$artist.m3u"; |
| 214 |
if ($use_underscore == 1) { $file =~ s/ /_/g; } |
294 |
if ($use_underscore == 1) { $file =~ s/ /_/g; } |
| 215 |
|
295 |
|
| 216 |
- system("cd \"$mp3dir\" ; ls -rt *.mp3 >\"$file\""); |
296 |
- if($encoder == 1) { |
| 217 |
+ system("cd \"$mp3dir\" ; ls *.mp3 | sort >\"$file\""); |
297 |
- system("cd \"$mp3dir\" ; ls -rt *.ogg >\"$file\""); |
|
|
298 |
+ if ($encoder == 2) { |
| 299 |
+ if ($numcpu == 1) { |
| 300 |
+ system("cd \"$mp3dir\" ; ls -rt *.ogg >\"$file\""); |
| 301 |
+ } else { |
| 302 |
+ system("cd \"$mp3dir\" ; ls *.ogg | sort >\"$file\""); |
| 303 |
+ } |
| 304 |
} |
| 305 |
else { |
| 306 |
- system("cd \"$mp3dir\" ; ls -rt *.mp3 >\"$file\""); |
| 307 |
+ if ($numcpu == 1) { |
| 308 |
+ system("cd \"$mp3dir\" ; ls -rt *.mp3 >\"$file\""); |
| 309 |
+ } else { |
| 310 |
+ system("cd \"$mp3dir\" ; ls *.mp3 | sort >\"$file\""); |
| 311 |
+ } |
| 312 |
} |
| 218 |
} |
313 |
} |
| 219 |
|
|
|
| 220 |
# Writes the MP3 tag to the file. The standard is to use the |