#!/usr/bin/perl # # mp3info-id3v1 -- tag an MP3 file with an ID3v1 tag. # # Needed because mp3info(1) uses ID3v2 tags, which xmms doesn't like. sub usage { die "usage failure"; } use Getopt::Long; use vars qw($opt_a $opt_l $opt_n $opt_t ); GetOptions("a=s", "l=s", "n=s", "t=s") or usage(); use MP3::Info; foreach $file (@ARGV) { my $tag = get_mp3tag ($file); $tag ||= { }; if (defined $opt_a) { $tag->{ARTIST} = $opt_a; } if (defined $opt_l) { $tag->{ALBUM} = $opt_l; } if (defined $opt_n) { $tag->{TRACKNUM} = $opt_n; } if (defined $opt_t) { $tag->{TITLE} = $opt_t; } remove_mp3tag ($file, 'ALL'); # remove an ID3v2 tag if found set_mp3tag ($file, $tag); }