~ubuntu-branches/debian/stretch/draai/stretch

« back to all changes in this revision

Viewing changes to script/dr_cdrip

  • Committer: Package Import Robot
  • Author(s): Joost van Baal-Ilić
  • Date: 2013-03-04 12:27:29 UTC
  • mfrom: (1.1.4)
  • Revision ID: package-import@ubuntu.com-20130304122729-bgfh2btf3n6uiqfc
Tags: 20130228-1
* New upstream (The Arjuna, Mill Road, CB1 Release; missed 20130208 - The
  Schwebebahn Release).
* manpages: dr_cdrip(1) removed upstream.
* control: updated from 3.9.2 to policy 3.9.3 (no changes needed).
* copyright: updated years.

Show diffs side-by-side

added added

removed removed

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