Skip to content

Instantly share code, notes, and snippets.

@kirbyUK
Created January 24, 2016 16:40
Show Gist options
  • Save kirbyUK/fb977fe84b758e4a02d5 to your computer and use it in GitHub Desktop.
Save kirbyUK/fb977fe84b758e4a02d5 to your computer and use it in GitHub Desktop.
Update MP3 tags from the command line
#!/usr/bin/perl -w
use Getopt::Long;
use MP3::Tag;
use strict;
my %tags;
GetOptions(
"artist=s" => \$tags{"artist"},
"album=s" => \$tags{"album"},
"comment=s" => \$tags{"comment"},
"genre=s" => \$tags{"genre"},
"title=s" => \$tags{"title"},
"track=i" => \$tags{"track"},
"year=s" => \$tags{"year"}
);
my $mp3 = MP3::Tag->new($ARGV[0]) or die "Cannot open '$ARGV[0]': $!\n";
$mp3->update_tags(\%tags);
$mp3->close;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment