/usr/bin/grabcd-rip is in grabcd-rip 0009-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
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 | #!/usr/bin/perl -w
#
# grabcd-rip -- read an audio CD and start encoding
#
# 2004-2005,2008 (c) by Christian Garbs <mitch@cgarbs.de>
# Licensed under GNU GPL
#
use strict;
use Audio::CD;
use Grabcd::ReadConfig;
# globals
my $VERSION = '0009';
my $config = Grabcd::ReadConfig::read_config('grabcd', qw(CDINFO_TEMP ENCODE_HOST ENCODE_BINARY));
### vvv-- warn about old config file entry and fix it
if ($config->{'ENCODE_BINARY'} =~ /encode\.pl$/) {
warn <<"EOF";
_
| | Your grabcd configuration contains the script name 'encode.pl'
| | in the variable ENCODE_BINARY. As of version 0009, the script
| | was renamed to 'grabcd-encode'. grabcd-rip will automatically
|_| try to use the new script name -- but this may fail.
_
(_) Please update your configuration file to suppress this warning.
EOF
;
$config->{'ENCODE_BINARY'} =~ s/encode\.pl$/grabcd-encode/;
}
### ^^^-- warn about old config file entry and fix it
my $file = $config->{CDINFO_TEMP};
my $host = $config->{ENCODE_HOST};
my $encode = $config->{ENCODE_BINARY};
# subs
sub readTag($)
{
my $tag = shift;
while (my $line = <CDINFO>) {
chomp $line;
if ($line =~ /^\s*$tag\s*=(.*)$/i) {
return $1;
}
}
return '';
}
# main
my $cd = Audio::CD->init;
die "could not initialize Audio::CD\n" unless defined $cd;
my $stat = $cd->close;
$stat = $cd->stat;
die "no cd detected\n" unless $stat->present;
open CDINFO, '<', $file or die "can't open `$file': $!\ndid you run grabcd-scan before?\n";
# check discid
my $cddb = $cd->cddb;
my $discid_want = $cddb->discid;
my $discid_have = readTag('DISCID');
die "discid does not match (want=$discid_want, have=$discid_have)\ndid you run grabcd-scan before?\n" unless $discid_want eq $discid_have;
# display album
print 'Album : '.readTag('ALBUM' )."\n";
# copy cdinfo
if ($host ne 'localhost' and $host ne '') {
system("scp $file $host:$file");
}
# cycle tracks
while ((my $track = readTag('TRACK')) ne '') {
print "\n\t*** grabbing track $track ***\n\n";
if ($host ne 'localhost' and $host ne '') {
system("icedax -q -O wav -t $track -paranoia - | ssh $host $encode $track");
} else {
system("icedax -q -O wav -t $track -paranoia - | $encode $track");
}
}
close CDINFO or die "can't close `$file': $!\n";
|