Enable use of dd(1) for ripping the tracks.

Enable use of -q quality setting with oggenc.
Minor robustification of the --outputdir parameter.
Fix WWW in pkg-descr.
Update pkg-comment to reflect the reality wrt dependencies.

PR:		38498
Submitted by:	maintainer
This commit is contained in:
Anders Nordby 2002-05-24 23:25:36 +00:00
parent 94bf327d53
commit f78b5a5cab
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=59933
4 changed files with 102 additions and 35 deletions

View file

@ -7,6 +7,7 @@
PORTNAME= ripit PORTNAME= ripit
PORTVERSION= 2.0 PORTVERSION= 2.0
PORTREVISION= 1
CATEGORIES= audio CATEGORIES= audio
MASTER_SITES= http://www.initio.no/~oyvindmo/distfiles/ MASTER_SITES= http://www.initio.no/~oyvindmo/distfiles/

View file

@ -1,6 +1,6 @@
--- ripit-orig.pl Sun Sep 23 14:12:08 2001 --- ripit.pl.orig Sat Aug 25 18:20:06 2001
+++ ripit.pl Sun Sep 23 14:12:09 2001 +++ ripit.pl Fri May 24 14:16:20 2002
@@ -9,41 +9,43 @@ @@ -9,41 +9,47 @@
# Create an M3U file # Create an M3U file
# #
# Options: # Options:
@ -12,6 +12,7 @@
+# --halt - powers off the machine when finished +# --halt - powers off the machine when finished
+# if your configuration supports it +# if your configuration supports it
+# --bitrate [rate] - Encode MP3 at this bitrate +# --bitrate [rate] - Encode MP3 at this bitrate
+# --quality [value] - Encode Ogg at this quality setting
# --year [year] - Tag MP3 with this year (included as CDDB # --year [year] - Tag MP3 with this year (included as CDDB
# does not store this information) # does not store this information)
-# --genre [genre] - Overrides CDDB genre, e.g. rock,funk -# --genre [genre] - Overrides CDDB genre, e.g. rock,funk
@ -26,13 +27,17 @@
+# --numcpu [cpus] - Number of parallel encoders to run +# --numcpu [cpus] - Number of parallel encoders to run
# #
# Version 2.0 20/08/01 - Simon Quinn # Version 2.0 20/08/01 - Simon Quinn
+# Ripping via FreeBSD's "dd" command - Lars Eggert <larse@isi.edu>
+# May use Ogg's -q quality option - Øyvind Møll <oyvindmo@initio.no>
# #
# Usage: ripit.pl [--halt] [--bitrate rate] [--year year] [--genre genre] -# Usage: ripit.pl [--halt] [--bitrate rate] [--year year] [--genre genre]
-# [--device cddevice] [--encopt options] [--encoder encoder] -# [--device cddevice] [--encopt options] [--encoder encoder]
+# [--device cddevice] [--encopt options] [--encoder encoder] -# [--cdripper cdripper] [--cdopt options] [--outputdir dir]
# [--cdripper cdripper] [--cdopt options] [--outputdir dir]
-# [start_track] -# [start_track]
+# [--numcpu cpus] [start_track] +# Usage: ripit.pl [--halt] [--bitrate rate] [--quality value] [--year year]
+# [--genre genre] [--device cddevice] [--encopt options]
+# [--encoder encoder] [--cdripper cdripper] [--cdopt options]
+# [--outputdir dir] [--numcpu cpus] [start_track]
#################################################################### ####################################################################
# #
# User configurable variables # User configurable variables
@ -40,21 +45,24 @@
$cddev = "/dev/cdrom"; # CD Audio device $cddev = "/dev/cdrom"; # CD Audio device
-$outputdir = "/tmp/cdrip/"; # Where the MP3s should go, -$outputdir = "/tmp/cdrip/"; # Where the MP3s should go,
+$outputdir = "/tmp/cdrip/"; # Where the MP3s should go, - # must have trailing /
# must have trailing / +$outputdir = "/tmp/cdrip"; # Where the MP3s should go
$bitrate = 160; # Bitrate for MP3s $bitrate = 160; # Bitrate for MP3s
-$encoder = 0; # 0 - Lame, 1 - OggVorbis -$encoder = 0; # 0 - Lame, 1 - OggVorbis
+$quality = 0; # Quality setting for Ogg
+$encoder = 0; # 0 - Lame, 1 - Gogo, 2 - OggVorbis +$encoder = 0; # 0 - Lame, 1 - Gogo, 2 - OggVorbis
$encopt = ""; # options for mp3 encoder $encopt = ""; # options for mp3 encoder
$cdripper = 0; # 0 - dagrab, $cdripper = 0; # 0 - dagrab,
# 1 - cdparanoia, 2 - cdda2wav, # 1 - cdparanoia, 2 - cdda2wav,
# 3 - tosha, 4 - cdd - # 3 - tosha, 4 - cdd
+ # 3 - tosha, 4 - cdd,
+ # 5 - dd (FreeBSD-4.4 and higher)
$cdopt = ""; # options for cdaudio ripper $cdopt = ""; # options for cdaudio ripper
+$numcpu = 1; # Number of parallel encoders to run +$numcpu = 1; # Number of parallel encoders to run
$CDDB_HOST = "freedb.freedb.org"; # set cddb host $CDDB_HOST = "freedb.freedb.org"; # set cddb host
$CDDB_PORT = 8880; # set cddb port $CDDB_PORT = 8880; # set cddb port
@@ -77,6 +79,9 @@ @@ -77,6 +83,9 @@
$nocddbinfo = 1; # Assume no CDDB info exists $nocddbinfo = 1; # Assume no CDDB info exists
$trackselection = ""; # Passed from command line $trackselection = ""; # Passed from command line
@ -64,7 +72,15 @@
#################################################### ####################################################
# Do the following: # Do the following:
# 1. Get command line parameters # 1. Get command line parameters
@@ -98,11 +103,16 @@ @@ -91,6 +100,7 @@
# Get the parameters from the command line
if ( ! &GetOptions("halt" => \$haltonfinish,
"bitrate=i" => \$bitrate,
+ "quality=i" => \$quality,
"year=i" => \$year,
"genre=s" => \$genre,
"device=s" => \$cddev,
@@ -98,11 +108,16 @@
"encoder=i" => \$encoder, "encoder=i" => \$encoder,
"cdripper=i" => \$cdripper, "cdripper=i" => \$cdripper,
"cdopt=s" => \$cdopt, "cdopt=s" => \$cdopt,
@ -73,18 +89,28 @@
+ "outputdir=s" => \$outputdir, + "outputdir=s" => \$outputdir,
+ "numcpu=i" => \$numcpu ) ) { + "numcpu=i" => \$numcpu ) ) {
+ print " + print "
+Usage: ripit.pl [--halt] [--bitrate rate] [--year year] +Usage: ripit.pl [--halt] [--bitrate rate] [--quality value] [--year year]
[--device cddevice] [--encopt options] [--encoder encoder] [--device cddevice] [--encopt options] [--encoder encoder]
[--cdripper cdripper] [--cdopt options] [--outputdir dir] [--cdripper cdripper] [--cdopt options] [--outputdir dir]
- [start_track]\n"; - [start_track]\n";
+ [--numcpu cpus] [start_track] + [--numcpu cpus] [start_track]
+Rippers: 0 - dagrab, 1 - cdparanoia, 2 - cdda2wav, 3 - tosha, 4 - cdd +Rippers: 0 - dagrab, 1 - cdparanoia, 2 - cdda2wav, 3 - tosha, 4 - cdd, 5 - dd
+Encoders: 0 - Lame, 1 - Gogo, 2 - OggVorbis +Encoders: 0 - Lame, 1 - Gogo, 2 - OggVorbis
+"; +";
exit 1; exit 1;
} }
@@ -132,8 +142,8 @@ @@ -110,6 +125,9 @@
print STDERR "Warning: year is not Y2K compliant - $year\n";
}
+# Make sure outputdir ends with a slash
+$outputdir =~ s/(.*)\/?/$1\//;
+
if ($haltonfinish == 1) {print "Will halt machine when finished.\n";}
# Get starting track parameter if it has been given
@@ -132,8 +150,8 @@
&create_dirs(); # Create directories MP3 files &create_dirs(); # Create directories MP3 files
&rip_cd(); # Rip, Encode & Tag &rip_cd(); # Rip, Encode & Tag
@ -95,7 +121,7 @@
&create_m3u(); # Create the M3U file for the MP3 files &create_m3u(); # Create the M3U file for the MP3 files
@@ -157,6 +167,10 @@ @@ -157,6 +175,10 @@
exit; exit;
@ -106,7 +132,15 @@
# #
# Create the track selection from the parameters passed # Create the track selection from the parameters passed
# on the command line # on the command line
@@ -336,31 +350,37 @@ @@ -280,7 +302,6 @@
#
sub create_dirs {
# Directory created will be: /outputdir/Artist - Album/
- # The value must end in /
$mp3dir = $outputdir.$artist." - ".$album."/";
@@ -336,31 +357,37 @@
$riptrackname = &get_trackname($_, $tracklist[$_ - 1]); $riptrackname = &get_trackname($_, $tracklist[$_ - 1]);
$riptrackno = $_; $riptrackno = $_;
@ -148,7 +182,7 @@
} }
} }
elsif ($cdripper == 4) { elsif ($cdripper == 4) {
@@ -369,6 +389,7 @@ @@ -369,9 +396,37 @@
$cdd_dev =~ s/c$//; $cdd_dev =~ s/c$//;
if (system("cdd -t $riptrackno -q -f $cdd_dev - 2>/dev/null | sox -t cdr -x - \"$riptrackname.rip\"")) { if (system("cdd -t $riptrackno -q -f $cdd_dev - 2>/dev/null | sox -t cdr -x - \"$riptrackname.rip\"")) {
&printflush(RIPLOG,"cdd failed on $tracklist[$_ - 1]\n"); &printflush(RIPLOG,"cdd failed on $tracklist[$_ - 1]\n");
@ -156,7 +190,37 @@
die "cdd failed on $tracklist[$_ - 1]"; die "cdd failed on $tracklist[$_ - 1]";
} }
} }
@@ -381,11 +402,13 @@ + elsif ($cdripper == 5) {
+ # Rip via FreeBSD's "dd" command and the associated CDDA devices
+ # under /dev. Requires 4.4-RELEASE or higher.
+ my $cdd_dev = $cddev;
+ if ($cdd_dev =~ /^\/dev\/(.*)/) { $cdd_dev = $1; }
+ die "dd extraction only works with ATAPI devices" unless $cddev =~ /acd/;
+ # See if the device corresponding to the track already exists...
+ my $trackdev = $cdd_dev;
+ $trackdev =~ s/(.*)c/$1/;
+ $trackdev .= "t$riptrackno";
+ unless (-e "/dev/$trackdev") {
+ # ...no, it doesn't. Create it.
+ &printflush(RIPLOG, "CDDA track device /dev/$trackdev, doesn't ".
+ "exist, creating...\n");
+ my $cwd = `pwd`;
+ chdir "/dev";
+ system("sh MAKEDEV $trackdev") == 0 or die "cannot make $trackdev";
+ chdir $cwd;
+ }
+ # Ready to extract the data. Also do endian conversion.
+ if (system("dd if=/dev/$trackdev conv=swab bs=2352 ".
+ "of=\"$riptrackname.rip\" 2> /dev/null")) {
+ &printflush(RIPLOG,"dd failed on $tracklist[$_ - 1]\n");
+ kill 1, @encoders;
+ die "cannot rip track $riptrackno";
+ }
+ }
else {
die "No CD Ripper defined";
}
@@ -381,11 +436,13 @@
rename "$riptrackname.rip","$riptrackname.wav"; rename "$riptrackname.rip","$riptrackname.wav";
&printflush(RIPLOG,"Rip complete $tracklist[$_ - 1]\n"); &printflush(RIPLOG,"Rip complete $tracklist[$_ - 1]\n");
@ -174,7 +238,7 @@
} }
} }
@@ -407,25 +430,33 @@ @@ -407,24 +464,37 @@
$riptrackno = $_; $riptrackno = $_;
$ncount++; $ncount++;
@ -201,18 +265,23 @@
$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\""; $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\"";
} }
elsif ($encoder == 1) { elsif ($encoder == 1) {
- $enc = "oggenc $encopt -b $bitrate -t \"$tracklist[$_ - 1]\" -a \"$artist\" -l \"$album\" -d \"$year\" -N $riptrackno -o \"$riptrackname.ogg\" \"$riptrackname.wav\"";
+ $enc = "gogo \"$riptrackname.wav\" \"$riptrackname.mp3\" $encopt -b $bitrate"; + $enc = "gogo \"$riptrackname.wav\" \"$riptrackname.mp3\" $encopt -b $bitrate";
+ } + }
+ elsif ($encoder == 2) { + elsif ($encoder == 2) {
$enc = "oggenc $encopt -b $bitrate -t \"$tracklist[$_ - 1]\" -a \"$artist\" -l \"$album\" -d \"$year\" -N $riptrackno -o \"$riptrackname.ogg\" \"$riptrackname.wav\""; + if ($quality > 0) {
} + $oggenc_quality_option = "-q $quality";
+ } else {
+ $oggenc_quality_option = "-b $bitrate";
+ }
+ $enc = "oggenc $encopt $oggenc_quality_option -t \"$tracklist[$_ - 1]\" -a \"$artist\" -l \"$album\" -d \"$year\" -N $riptrackno -o \"$riptrackname.ogg\" \"$riptrackname.wav\"";
+ }
+ else { + else {
+ die "No encoder defined"; + die "No encoder defined";
+ } }
if ( ! system("$enc >$enclog 2>&1 </dev/null")) { if ( ! system("$enc >$enclog 2>&1 </dev/null")) {
@@ -438,7 +508,8 @@
@@ -438,7 +469,8 @@
&printflush(RIPLOG,"MP3 Encoder Failed on $tracklist[$_ - 1]\n"); &printflush(RIPLOG,"MP3 Encoder Failed on $tracklist[$_ - 1]\n");
die "MP3 Encoder Failed on $tracklist[$_ - 1]"; die "MP3 Encoder Failed on $tracklist[$_ - 1]";
} }
@ -222,7 +291,7 @@
} }
exit ; exit ;
} }
@@ -452,10 +484,10 @@ @@ -452,10 +523,10 @@
$file="$artist.m3u"; $file="$artist.m3u";
if ($use_underscore == 1) { $file =~ s/ /_/g; } if ($use_underscore == 1) { $file =~ s/ /_/g; }

View file

@ -5,10 +5,9 @@ ripit is a small front-end program written in perl for ripping,
encoding and tagging MP3s or Ogg/Vorbis files from audio CDs. It encoding and tagging MP3s or Ogg/Vorbis files from audio CDs. It
is a console program that needs no user intervention. It requires is a console program that needs no user intervention. It requires
p5-CDDB for CDDB access. A track ripper program and an encoder are p5-CDDB for CDDB access. A track ripper program and an encoder are
also needed, but are not installed automatically by this port, also needed.
since users' preferences vary.
WWW: http://www.bigfoot.com/~simon.quinn/ripit.html WWW: http://www.geocities.com/ukcave/ripit.html
-- --
Port by Oyvind Moll <oyvindmo@initio.no> Port by Oyvind Moll <oyvindmo@initio.no>

View file

@ -1,7 +1,5 @@
ripit can use a number of different programs to do the actual track ripit can use a number of different programs to do the actual track
extraction and audio encoding. For ripit to be useful you need to extraction and audio encoding. By default ripit uses dagrab and
have at least one extract program and one encoder program installed. lame respectively, so this port depends on those two having been
However, since the choices are many and the users' needs and wants installed. If you want ripit to use other helper utils, just install
are varied, none of these are automatically installed as part of them and tell ripit which ones to use.
the ripit install. Remember to make sure you install the extractor(s)
and encoder(s) you want.