This file is indexed.

/usr/bin/grabcd-scan 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
 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
#!/usr/bin/perl -w
#
# grabcd-scan  --  create track list to an audio CD
#
# 2004-2006,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 ($keep_year, $keep_artist, $keep_title, $keep_version) = ( 1, 1, 0, 0 );

my $config = Grabcd::ReadConfig::read_config('grabcd', qw( CDINFO_TEMP CDINFO_REMOTE ));
my $file   = $config->{CDINFO_TEMP};
my $remote = $config->{CDINFO_REMOTE};

my $args = join '', @ARGV;
$args =~ tr/A-Z/a-z/;

while ( $args =~ /(.)/g ) {
    if ($1 eq "y") {
	$keep_year = 1 - $keep_year;
    } elsif ($1 eq "a") {
	$keep_artist = 1 - $keep_artist;
    } elsif ($1 eq "t") {
	$keep_title = 1 - $keep_title;
    } elsif ($1 eq "v") {
	$keep_version = 1 - $keep_version;
    } else {
	print "a  artist  (keep = $keep_artist)\n";
	print "t  title   (keep = $keep_title)\n";
	print "v  version (keep = $keep_version)\n";
	print "y  year    (keep = $keep_year)\n";
	exit;
    }
}

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;

my $cddb = $cd->cddb;
my $discid = $cddb->discid;
my @tracks = @{$stat->tracks};

print "discid=[$discid], track_count=[".$stat->total_tracks."]\n";

use Term::ReadLine;
my ($artist, $album, $path, $title, $version, $year, $catalog);
my $term = new Term::ReadLine 'grabcd-scan '.$VERSION;
$|++;

$catalog = $term->readline("Catalog :");
$catalog =~ s/^\s+//;
$catalog =~ s/\s+$//;
$artist  = $term->readline("Artist  :");
$artist  =~ s/^\s+//;
$artist  =~ s/\s+$//;
$album   = $term->readline("Album   :");
$album   =~ s/^\s+//;
$album   =~ s/\s+$//;

open CDINFO, '>', $file or die "can't open `$file': $!\n";
print CDINFO "DISCID=$discid\n";
print CDINFO "CATALOG=$catalog\n";
print CDINFO "ALBUM=$album\n";
# read path
if ($artist eq '') {
    $path = $album;
} else {
    $path   =  $artist;
    $path   =~ tr,/,_,;
    $album  =~ tr,/,_,;
    $path  .=  '/' . $album;
}
$path   = $term->readline("Path    :", $path);
$path   =~ s/^\s+//;
$path   =~ s/\s+$//;
print CDINFO "PATH=$path\n";

# {
foreach my $track (1 .. $stat->total_tracks) {
    unless ($tracks[$track-1]->is_audio) {
	print "\nskipping $track, no audio...\n";
	next;
    }
    print CDINFO "\nTRACK=$track\n";
    my ($minutes, $seconds) = $tracks[$track-1]->length;
    printf "\n == Track %02d/%02d  %02d:%02d  ==\n", $track, $stat->total_tracks, $minutes, $seconds;
    if ($keep_artist) {
	$artist  = $term->readline("Artist  :", $artist);
    } else {
	$artist  = $term->readline("Artist  :");
    }
    if ($keep_title) {
	$title   = $term->readline("Title   :", $title);
    } else {
	$title   = $term->readline("Title   :");
    }
    if ($keep_version) {
	$version = $term->readline("Version :", $version);
    } else {
	$version = $term->readline("Version :");
    }
    if ($keep_year) {
	$year    = $term->readline("Year    :", $year);
    } else {
	$year    = $term->readline("Year    :");
    }
    $artist =~ s/^\s+//;
    $artist =~ s/\s+$//;
    $title  =~ s/^\s+//;
    $title  =~ s/\s+$//;
    $version=~ s/^\s+//;
    $version=~ s/\s+$//;
    $year   =~ s/^\s+//;
    $year   =~ s/\s+$//;
    print CDINFO "ARTIST=$artist\nTITLE=$title\nVERSION=$version\nYEAR=$year\n";
}

close CDINFO or die "can't close `$file': $!\n";

system($ENV{EDITOR}, $file);

$path =~ s,/,___,g;
if ($remote !~ m:^/:) {
    # remote operation
    $path =~ s/([;"\\' &<>()])/\\$1/g;
}
system('scp', $file, "$remote/$path");