
Music::Audioscrobbler::MPD - Module providing routines to submit songs to last.fm from MPD.

use Music::Audioscrobbler::MPD
my $mpds = Music::Audioscrobbler::MPD->new(\%options);
$mpds->monitor_mpd();

Music::Audioscrobbler::MPD is a scrobbler for MPD. As of version .1, Music::Audioscrobbler::Submit is used to submit information to last.fm.
All internal code is subject to change. See musicmpdscrobble for usage info.

Please see the documentation for musicmpdscrobble which is available from
musicmpdscrobble --longhelp

my $mpds = Music::Audioscrobbler::MPD->new($options);
Starts the main loop.
Get or set options via hash. Here is a list of available options:
Perl file used to get options from
lastfm username
lastfm password. Not needed if lastfm_md5password is set.
MD5 hash of lastfm password.
Client ID provided by last.fm. Defaults to "tst", which is valid for testing only.
Set to the version of your program when setting a valid client_id. Defaults to "1.0"
hostname of mpd_server
port for mpd_server
mpd password
Set verbosity level (1 through 4)
File to output loginfo to
Path to file to queue info to
Root to MP3 files
Use the Music::Tag::MusicBrainz plugin to get missing "mbid" value.
Array of commands to run after submit
Array of commands to run on start of play
True if monitor should be turned on
True if you want to use Music::Tag to get info from file
True if you want to Music::Tag info to override file info
Options for Music::Tag
Specify a procy server in the form http://proxy.server.tld:8080. Please note that environment is checked for HTTP_PROXY, so you may not need this option.
If set to true, will scrobble HTTP streams.

returns open socket to mpd program.
Connect to MPD if necessary
Return true if connected to mpd.
Process response from mpd.
send a command to mpd.
send password to mpd.
Send mpd a command and parse the output if output is a column seperated list.
get_status command. Returns hashref with:
* volume: (0-100)
* repeat: (0 or 1)
* random: (0 or 1)
* playlist: (31-bit unsigned integer, the playlist version number)
* playlistlength: (integer, the length of the playlist)
* playlistqueue: (integer, the temporary fifo playlist version number)
* xfade: <int seconds> (crossfade in seconds)
* state: ("play", "stop", or "pause")
* song: (current song stopped on or playing, playlist song number)
* songid: (current song stopped on or playing, playlist songid)
* time: <int elapsed>:<time total> (of current playing/paused song)
* bitrate: <int bitrate> (instantaneous bitrate in kbps)
* audio: <int sampleRate>:<int bits>:<int channels>
* updating_db: <int job id>
* error: if there is an error, returns message here
get_status command. Returns hashref with:
file: albums/bob_marley/songs_of_freedom/disc_four/12.bob_marley_-_could_you_be_loved_(12"_mix).flac
Time: 327
Album: Songs Of Freedom - Disc Four
Artist: Bob Marley
Title: Could You Be Loved (12" Mix)
Track: 12
Pos: 11
Id: 6601
Print to log.
returns filehandle to log.
Reference to underlying Music::Audioscrobbler::Submit object. If passed a Music::Audioscrobbler::Submit object, will use that one instead.
reset current song info.
Run on song change
Run on poll
print current status to STDERR
Scrobble current song
Fork and run list of commands.

musicmpdscrobble, Music::Audioscrobbler::Submit, Music::Tag


Edward Allen, ealleniii _at_ cpan _dot_ org

Copyright (c) 2007 Edward J. Allen III
Some code and inspiration from Audio::MPD Copyright (c) 2005 Tue Abrahamsen, Copyright (c) 2006 Nicholas J. Humfrey, Copyright (c) 2007 Jerome Quelin

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either:
a) the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version, or
b) the "Artistic License" which comes with Perl.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See either the GNU General Public License or the Artistic License for more details.
You should have received a copy of the Artistic License with this Kit, in the file named "Artistic". If not, I'll be glad to provide one.
You should also have received a copy of the GNU General Public License along with this program in the file named "Copying". If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA or visit their web page on the Internet at http://www.gnu.org/copyleft/gpl.html.