This file is indexed.

/usr/share/doc/libmp3-info-perl/examples/mp3id is in libmp3-info-perl 1.24-1.1.

This file is owned by root:root, with mode 0o644.

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
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
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
#!/usr/bin/perl

eval 'exec /usr/bin/perl  -S $0 ${1+"$@"}'
    if 0; # not running under some shell

# mp3id 0.4 (c) 1999-2000 Piotr Roszatycki <dexter@fnet.pl>

# This is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free
# Software Foundation; either version 2, or (at your option) any later
# version.


use Cwd;
use File::Copy;
use Getopt::Long;
use MP3::Info qw(:all);

use_winamp_genres();

my @files;

GetOptions( \%opt, 
    "artist|a=s",
    "album|l=s",
    "title|t=s",
    "comment|c=s",
    "year|y=i",
    "genre|g=s",
    "tracknum|n=i",
    "input|i",
    "rename|r",
    "various|v",
    "help|h",
    "<>", \&optfiles 
);

sub optfiles {
    push @files, shift;
}

die "mp3id 0.4 (c) 1999-2000 Piotr Roszatycki <dexter\@debian.org>\n".
    "This is free software under GPL and WITHOUT ANY WARRANTY\n".
    "\n".
    "usage: mp3id [--artist|-a <str>] [--title|-t <str>] [--comment|-c <str>]\n".
    "             [--album|-l <str>] [--year|-y <num>] [--genre|-g <str>]\n".
    "             [--tracknum|-n <num>] [--input|-i] [--rename|-r] [--various|-v]\n".
    "             [--help|-h]\n".

    "\n".
    "    --artist|-a <str>   sets name of artist\n".
    "    --album|-l <str>    sets album name\n".
    "    --title|-t <str>    sets song title\n".
    "    --comment|-c <str>  sets comment\n".
    "    --year|-y <num>     sets published year (4 digits)\n".
    "    --genre|-g <str>    sets genre or show genre list if given 0\n".
    "    --tracknum|-n <num> sets track number, automatically if given 0\n".
    "    --input|-i          inputs data in interactive mode\n".
    "    --rename|-r         renames filename to\n".
    "                        ../\$artist-\$album/\$tracknum-\$artist-\$title.mp3\n".
    "    --various|-v        sets \"Various\" as artist of album for renamed filename\n".
    "    --help|-h           this help info\n".
    "\n"
    if $opt{help};

if( defined $opt{genre} && $opt{genre} eq "0" ) {
    foreach( sort @mp3_genres ) {
	print $_, "\n";
    }
    exit;
}

$cwd = cwd;

if( ! @files ) {
    opendir(DIR, $cwd) || die "can't opendir $cwd: $!";
    @files = sort grep { /\.mp3$/i && -f "$cwd/$_" } readdir(DIR);
    closedir DIR;                                                
}

my $tracknum = 0;

foreach $file ( @files ) {

    my $info = get_mp3info($file) or next;
    my $tag = get_mp3tag($file);

    $tracknum ++;

    $tag->{ARTIST}   = sprintf "%.30s", $opt{artist}         if defined $opt{artist};
    $tag->{ALBUM}    = sprintf "%.30s", $opt{album}          if defined $opt{album};
    $tag->{TITLE}    = sprintf "%.30s", $opt{title}          if defined $opt{title};
    $tag->{COMMENT}  = sprintf "%.28s", $opt{comment}        if defined $opt{comment};
    $tag->{YEAR}     = sprintf "%04i",  $opt{year} % 1e4     if defined $opt{year};
    $tag->{GENRE}    = sprintf "%.30s", $opt{genre}          if defined $opt{genre};
    $tag->{TRACKNUM} = sprintf "%02i",  $opt{tracknum} % 1e2 if defined $opt{tracknum};
    $tag->{TRACKNUM} = sprintf "%02i",  $tracknum	     if defined $opt{tracknum} &&
	$opt{tracknum} == 99;

    print "Filename: ", $file, "\n";

    if( $opt{input} ) {
	print "Artist [",   $tag->{ARTIST},   "]: ";
	$_ = <>; 
	if( chomp $_ ) {
	    $_ ne '' and $tag->{ARTIST} = sprintf "%.30s", $_;
	} else {
	    print "\n";
	    delete $tag->{ARTIST};
	}
	print "Album [",    $tag->{ALBUM},    "]: ";
	$_ = <>; 
	if( chomp $_ ) {
	    $_ ne '' and $tag->{ALBUM} = sprintf "%.30s", $_;
	} else {
	    print "\n";
	    delete $tag->{ALBUM};
	}
	print "Title [",    $tag->{TITLE},    "]: ";
	$_ = <>; 
	if( chomp $_ ) {
	    $_ ne '' and $tag->{TITLE} = sprintf "%.30s", $_;
	} else {
	    print "\n";
	    delete $tag->{TITLE};
	}
	print "Comment [",  $tag->{COMMENT},  "]: ";
	$_ = <>; 
	if( chomp $_ ) {
	    $_ ne '' and $tag->{COMMENT} = sprintf "%.28s", $_;
	} else {
	    print "\n";
	    delete $tag->{COMMENT};
	}
	print "Year [",     $tag->{YEAR},     "]: ";
	$_ = <>; 
	if( chomp $_ ) {
	    $_ ne '' and $tag->{YEAR} = sprintf "%04i", $_;
	} else {
	    print "\n";
	    delete $tag->{YEAR};
	}
	print "Genre [",    $tag->{GENRE},    "]: ";
	$_ = <>; 
	if( chomp $_ ) {
	    $_ ne '' and $tag->{GENRE} = sprintf "%.30s", $_;
	} else {
	    print "\n";
	    delete $tag->{GENRE};
	}
	print "Tracknum [", $tag->{TRACKNUM}, "]: ";
	$_ = <>; 
	if( chomp $_ ) {
	    $_ ne '' and $tag->{TRACKNUM} = sprintf "%02i", $_;
	} else {
	    print "\n";
	    delete $tag->{TRACKNUM};
	}
    }

    if( defined $opt{artist}   || defined $opt{title} || 
	defined $opt{comment}  || defined $opt{album} ||
	defined $opt{year}     || defined $opt{genre} || 
	defined $opt{tracknum} || defined $opt{input} ) {
	set_mp3tag($file, $tag);
	$tag = get_mp3tag($file);
    }

    print "A:[", $tag->{ARTIST},   "] " if $tag->{ARTIST} ne '';
    print "L:[", $tag->{ALBUM},    "] " if $tag->{ALBUM} ne '';
    print "T:[", $tag->{TITLE},    "] " if $tag->{TITLE} ne '';
    print "C:[", $tag->{COMMENT},  "] " if $tag->{COMMENT} ne '';
    print "Y:[", $tag->{YEAR},     "] " if $tag->{YEAR} ne '';
    print "G:[", $tag->{GENRE},    "] " if $tag->{GENRE} ne '';
    print "T:[", $tag->{TRACKNUM}, "] " if $tag->{TRACKNUM} ne '';
    print "\n";

    if( defined $opt{rename} ) {
	my $name;
	$name = $opt{various} ? "Various" : "$tag->{ARTIST}";
	$name =~ tr/-/+/;
	$name .= "-$tag->{ALBUM}";
	$name =~ tr/ ()/_[]/;
	$name =~ s/[^a-zA-Z0-9_\[\]-]/+/g;
	my $dir = $tag->{ALBUM} ? "../$name/" : "";
    
	$name = "$tag->{ARTIST}";
	$name =~ tr/-/+/;
	$name .= "-$tag->{TITLE}";
	$name .= " $tag->{COMMENT}" if $tag->{COMMENT};
	$name =~ tr/ ()/_[]/;
	$name =~ s/[^a-zA-Z0-9_\[\]-]/+/g;

	$name = sprintf "%02d-$name.mp3", $tag->{TRACKNUM} ? $tag->{TRACKNUM} : $n;
    
	my $src = $file;
	my $dst = "$dir$name";
	$dst =~ s/\//\\/g if $MSDOS;

        print "Rename: ", $dst, "\n";

	mkdir $dir, 0755;
	move( $src, $dst );
    }

    print "\n";

}


__END__

=head1 NAME

mp3id - MP3 tag manipulate utility

=head1 SYNOPSIS

B<mp3id> S<[ B<--artist>|B<-a> I<str> ]> S<[ B<--title>|B<-t> I<str> ]> 
	  S<[ B<--comment>|B<-c> I<str> ]> S<[ B<--album>|B<-l> I<str> ]> 
	  S<[ B<--year>|B<-y> I<num> ]> S<[ B<--genre>|B<-g> I<str> ]> 
	  S<[ B<--tracknum>|B<-n> I<num> ]> S<[ B<--input>|B<-i> ]> 
	  S<[ B<--rename>|B<-r> ]> S<[ B<--various>|B<-v> ]>
	  S<[ B<--help>|B<-h> ]>

=head1 DESCRIPTION

mp3id is a very simple tool written in perl with usage of MPEG::MP3Info
library. This utility allows to read tag, modify in interactive mode or 
command line, and rename filename.

=head1 OPTIONS

=over 8

=item B<--artist>|B<-a> I<str>

Sets name of artist.

=item B<--album>|B<-l> I<str>

Sets album name.

=item B<--title>|B<-t> I<str>

Sets song title.

=item B<--comment>|B<-c> I<str>

Sets comment.

=item B<--year>|B<-y> I<num>

Sets published year (4 digits).

=item B<--genre>|B<-g> I<str>

Sets genre or show genre list if given 0.

=item B<--tracknum>|B<-n> I<num>

Sets track number, automatically if given 0.

=item B<--input>|B<-i>

Inputs data in interactive mode. Enter means default value. EOF (ctrl+D) means
empty value.

=item B<--rename>|B<-r>

Renames filename to ../$artist-$album/$tracknum-$artist-$title.mp3 after
modifing tag. The variables are taken from tag info.

=item B<--various>|B<-v>

Sets "Various" as artist of album for renamed filename. This is helpful
for OST or albums of various artists.

=item B<--help>|B<-h>

Show help info.

=head1 AUTHOR AND COPYRIGHT

(c) 1999 Piotr Roszatycki E<lt>dexter@debian.orgE<gt>

All rights reserved.  This program is free software; you can redistribute it 
and/or modify it under the terms of the GNU General Public License, the latest version.