First install the following modules. The first pulls tag metadata out of MP3 files, while the second sends the information to last.fm.
http://search.cpan.org/~daniel/MP3-Info-1.23/Info.pm
http://search.cpan.org/~roam/Audio-Scrobbler-0.01/lib/Audio/Scrobbler.pm
(to install these use: perl -MCPAN -e 'shell', then install MP3::Info, and install Audio::Scrobbler)
use MP3::Info;
use Audio::Scrobbler;
my $info = get_mp3info($file);
my $tag = get_mp3tag($file) or die "No TAG info";
my $mp3_title = $tag->{TITLE};
my $mp3_artist = $tag->{ARTIST};
my $mp3_album = $tag->{ALBUM};
my $mp3_length = int($info->{SECS});
$scrob = new Audio::Scrobbler(
cfg => {
progname => "tst",
progver => "1.0",
username => "someone",
password => "somepass",
verbose => "1"
}
);
$scrob->handshake();
$scrob->submit(
{
title => "$mp3_title",
artist => "$mp3_artist",
album => "$mp3_album",
length => "$mp3_length"
}
);
No comments:
Post a Comment