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();
Edward Allen, ealleniii _at_ cpan _dot_ org
Music::Audioscrobbler::MPD is a scrobbler for MPD. It may one day be distributed in a package called Music::Audioscrobbler, but is independent at the momment.
All internal code is subject to change. See musicmpdscrobble for usage info.
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 throuch 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 to use MusicDB plugin for Music::Tag
Options for Music::Tag
returns open socket to mpd program.
Connect to MPD if necessary
Return true if connected to mpd.
Process response from mpd.
send a commnd 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
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.
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.
returns or optionally sets LWP UA.
Converts a Music::Tag object, a hash, or a filename to a simple hash for processing.
Get or set music_tag_opts
use Music::Tag to get info from a file.
Reference to queue of files to scrobble.
Perform handshake with Last.FM
Takes filename / Music::Tag object / Generic Hash as value and submits to last.fm
Use Music::Brainz to get mbid for a Music::Tag object. Requires Music::Tag::MusicBrainz;
Process up to 50 files from scrobble_queue. Recursivly calls itself if necessary / possible to empty scrobble_queue
musicmpdscrobble, Music::Tag
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 library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.7 or, at your option, any later version of Perl 5 you may have available.
To install Music::Audioscrobbler::MPD, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Music::Audioscrobbler::MPD
CPAN shell
perl -MCPAN -e shell install Music::Audioscrobbler::MPD
For more information on module installation, please visit the detailed CPAN module installation guide.