Friday, June 29, 2012
MP3 tagging with Perl
#!/usr/bin/perl
use strict;
use warnings;
use MP3::Tag;
use File::Basename;
my $Directory = ".";
while (<$Directory/*.mp3>) {
my ($FileName) = basename($_, '.mp3');
my $Mp3 = MP3::Tag->new($_);
$Mp3->title_set($FileName);
$Mp3->artist_set('Artist');
$Mp3->album_set('Album');
$Mp3->year_set('2012');
$Mp3->update_tags();
print "Filename: $_\n";
print "Artist: " . $Mp3->artist . "\n";
print "Title: " . $Mp3->title . "\n";
print "Album: " . $Mp3->album . "\n";
print "Year: " . $Mp3->year . "\n";
print "Genre: " . $Mp3->genre . "\n";
$Mp3->close();
}
__END__
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment