use strict; use MP3::Info; use Getopt::Long; use vars qw($tag $value); my %value; my @field = qw(title artist album year comment genre tracknum); @value{@field} = ('') x @field; GetOptions(map { $_.'=s',\$value{$_} } keys %value); my $file = shift or USAGE() and exit; my $tag = get_mp3tag($file) or die "no ID3 tag for '$file'"; my $flag; for (keys %value) { next unless $value{$_}; $tag->{uc $_} = $value{$_}; $flag = 1; } set_mp3tag($file,$tag) if $flag; display_tag($tag); sub display_tag { my %tag = %{+shift}; write while ($tag,$value) = each %tag; } sub USAGE { print "USAGE: $0 [options] file\noptions:\n"; print map { "\t--$_\n" } @field; } format STDOUT = @>>>>>>>>>>: @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $tag,$value . __END__ =pod =head1 NAME id3_tweaker.pl - MP3::Info script =head1 DESCRIPTION This is a simple script that uses MP3::Info to alter the a single ID3 tag fields or multiple ID3 tag fields. There is no -help or -h option, just run the script by itself for the USAGE. =head1 SYNOPSIS for *nix: ./id3_tweaker.pl --year='1984' foo.mp3 for win32: perl id3_tweaker.pl --year='1984' foo.mp3 or run with only argument being the file to display info: ./id3_tweaker.pl foo.mp3 retrieve list of tags that can be altered: ./id3_tweaker.pl =cut