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 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218
|
#!/usr/bin/perl -w
use strict;
# dj@nagy:~/tmp% COMMENT="1998 A&M Records; 540 974-2" abcde -l
# ~/.abcde.conf
#
# abcde -w "1998 A&M Records; 540 974-2"
# dj@nagy:~/tmp% abcde -w '1993 A\&M Records\; 540 126-2'
#
# cat ~/.abcde.conf
# LOWDISK=y
# OGGENCOPTS="-q 9"
# OUTPUTFORMAT='${ARTISTFILE}/${ALBUMFILE}/${TRACKNUM}-${TRACKFILE}'
# VAOUTPUTFORMAT='Various/${ALBUMFILE}/${TRACKNUM}-${ARTISTFILE}-${TRACKFILE}'
#
#
print "run OGGENCODEROPTS=\"-q 9\" COMMENT=\"blah blah\" abcde -l"
## OUTPUTFORMAT='${ARTISTFILE}-${ALBUMFILE}/${TRACKNUM}.${TRACKFILE}'
# OUTPUTFORMAT='${ARTISTFILE}/${ALBUMFILE}/${TRACKNUM}-${TRACKFILE}'
## VAOUTPUTFORMAT='Various-${ALBUMFILE}/${TRACKNUM}.${ARTISTFILE}-${TRACKFILE}'
# VAOUTPUTFORMAT='Various/${ALBUMFILE}/${TRACKNUM}-${ARTISTFILE}-${TRACKFILE}'
exit 0
my $d = 0; # set to 1 for debug
# my $d = 1;
my $quality = $ENV{CDRIP_QUALITY} || 7;
# empty @ARGV to get a sane diamond operator
my @argv = @ARGV;
@ARGV = ();
my @songlist;
while (<>) {
chomp;
push @songlist, $_;
}
$d and print "songlist: @songlist\n";
my $i = 0;
for my $s (@songlist) {
$i++;
next if ($s =~ /^skip$/);
my ($ra, $rt) = split ' - ', $s;
defined $ra or die "hu!? no artist in songlist file!\n";
unless (defined $rt) {
# we are not in sampler mode
$rt = $ra;
undef $ra;
}
# songtitle
my $t = $rt;
$t =~ s/ /_/g;
$t =~ s[/][_]g and warn "removed evil / from $t\n";
my $a;
if (defined $ra) {
# artist
$a = $ra;
$a =~ s/ /_/g;
$a =~ s[/][_]g;
}
my $w = $i;
$w = "0".$i unless ($i > 9);
if (defined $a) {
$w = "$w"."-"."$a"."-"."$t"; # filename for .wav
} else {
$w = "$w" . "-" . "$t";
}
# $m = $w.".mp3"; # filename for .mp3
my $m = $w.".ogg"; # filename for .ogg
# $call = "cdparanoia $i - | lamer - $m";
# [09-Jan:22:21 koef] $oggenc -m 2 Track01.wav
# [09-Jan:22:21 koef] mode 2 zou 128 kbit moeten doen
# mp3's zijn meestal in 128. oggenc default 144 kbit, da vreet meer schijf
# [20-Jun:12:17 Fruit] 1411 kbit
# [20-Jun:12:17 Fruit] ik rip naar flac :)
# [20-Jun:12:18 Fruit] ogg -q3 is voor de meeste muziek van mij goed genoeg
# [20-Jun:12:18 Fruit] als er iets gevoeligs tussen zit pak ik meestal -q5
# my $call = "cdparanoia -q $i - | oggenc -b 128 -o $m";
# gives bitrate_nominal=128031
# let's see if we can crank quality up somewhat: -q 7 gives
# bitrate_nominal=224032
my $call = "cdparanoia -q $i - | oggenc -q $quality -o \"$m\"";
for (@argv) {
$call .= " \"$_\"";
}
if (defined $ra) {
$call .= " -a \"$ra\"";
}
$call .= " -t \"$rt\" -";
warn "system($call)\n";
system($call) unless $d;
# system("id3 -t \"$rt\" $m") unless $d;
# system("id3 -a \"$ra\" $m") unless $d;
}
__END__
=pod
=head1 NAME
dr_cdrip - rip audio cd's to ogg
=head1 SYNOPSIS
B<dr_cdrip> B<[>I<args>B<]> < I<id3-tag-file>
=head1 DESCIPTION
dr_cdrip sets up a cdparanoia(1) - oggenc(1) pipe for each track on your
audio cd, so that the audio on your cd will be stored as .ogg files on your
harddisk. I<args> will get passed to each songs' oggenc(1) invocation.
I<id3-tag-file> could look like this:
Jaffa - Star 67
Think of one - Den Antwaarpse Shabi
Klute - Angry Woman
Electrotwist - The Smurfer
Evil characters are discarded from the file, we don't want
them to appear in filenames. If a line lacks a ' - ', the
line is assumed to be a title.
Defauls setting of oggenc(1)'s --quality level is 7, override by
setting the CDRIP_QUALITY environment variable.
Note: mp3's id3 tags seem to be called "comments" in the .ogg world.
=head1 EXAMPLE
dj@gelfand ~$ export CDRIP_QUALITY=9
dj@gelfand /h.../The_New_York_Contemporary_Five$ dr_cdrip \
-l "The New York Contemporary Five" -a "Archie Shepp" \
-c "description=Don Cherry: crnt, Archie Shepp: ts, Don \
Moore: b, JC Moses:d" -c "genre=Jazz" -c "date=1963" \
-c "location=Copenhagen" \
-c "copyright=1991 Storyville Records" -c "license=All Rights Reserved" \
-c "organization=Storyville" \
-c "contact=http://www.storyville-records.com/" \
-c "diskid=bd10c70d" < /tmp/songlist
See DISCID HOWTO on
http://freedb.org/modules.php?name=Sections&sop=viewarticle&artid=6 for info on
disk id. Beware! A diskid comment is _not_ mentioned in the xiph.org
suggestions!
(oggenc's -t will be used by dr_cdrip. -a might be.)
supported extra comments are (see ogg123.c)
VERSION=, TRACKNUMBER=, ISRC=
ARTIST is -a, ALBUM is -l TITLE is -t.
VERSION is e.g. 'Biosphere Foo Mix'. Multipe ARTIST tags can occur; this use
is encouraged if applicable. -c foo will be displayed by ogg123 as 'Comment:
foo'.
Run something like:
cdcd tracks | sed 's/^.*\]\ *//' | sed 's/\ $//'
to extract a songlist from a cddb database.
=head1 BUGS
The format of the songinfo input file is non-standard. Support for cddb is
lacking.
=head1 SEE ALSO
http://xiph.org/ogg/vorbis/doc/v-comment.html
abcde - A Better CD Encoder at http://www.hispalinux.es/~data/abcde.php
=head1 VERSION, SOURCE
This file is maintained at http://git.mdcc.cx/draai
=head1 HISTORY
First version written 2001-01-09. Last maintenance, as of 2007-08-22,
done at 2005-12-14.
=head1 COPYRIGHT
Copyright: © 2001-2005 Joost van Baal
This program is in the public domain.
=head1 AUTHOR
Joost van Baal <spamhere@mdcc.cx>
=cut
|