NAME
Music::MPDScrobble - Module providing routines to submit songs to last.fm from MPD
SYNOPSIS
use Music::MPDScrobble my $mpds = Music::MPDScrobble->new(\%options); $mpds->monitor_mpd();
AUTHOR
Edward Allen, ealleniii _at_ cpan _dot_ org
DESCRIPTION
The motiviation behind this was to provide a convenient method for fixing broken tags.
This module is a wrapper module, which calls various plugin modules to find information about a music file and write it back into the tag.
METHODS
- new()
-
my $mpds = Music::MPDScrobble->new($options);
- monitor_mpd()
-
Starts the main loop.
- options()
-
Get or set options via hash. Here is a list of available options:
- optionfile
-
Perl file used to get options from
- lastfm_username
-
lastfm username
- lastfm_password
-
lastfm password. Not needed if lastfm_md5password is set.
- lastfm_md5password
-
MD5 hash of lastfm password.
- lastfm_client_id
-
Client ID provided by last.fm. Defaults to "tst", which is valid for testing only.
- lastfm_client_version
-
Set to the version of your program when setting a valid client_id. Defaults to "1.0"
- mpd_server
-
hostname of mpd_server
- mpd_port
-
port for mpd_server
- mpd_password
-
mpd password
- verbose
-
Set verbosity level (1 throuch 4)
- logfile
-
File to output loginfo to
- scrobblequue
-
Path to file to queue info to
- music_directory
-
Root to MP3 files
- runonsubmit
-
Array of commands to run after submit
- runonstart
-
Array of commands to run on start of play
- monitor
-
True if monitor should be turned on
- musictag
-
True if you want to use Music::Tag to get info from file
- musicdb
-
True to use MusicDB plugin for Music::Tag
- music_tag_opts
-
Options for Music::Tag
INTERNAL METHODS (for reference)
- mpdsock()
-
returns open socket to mpd program.
- connect()
-
Connect to MPD if necessary
- is_connected()
-
Return true if connected to mpd.
- process_feedback
-
Process response from mpd.
- send_command($command)
-
send a commnd to mpd.
- send_command($command)
-
send password to mpd.
- get_info($command)
-
Send mpd a command and parse the output if output is a column seperated list.
- get_status($command)
-
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_current_song_info($command)
-
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
- status($level, @message)
-
Print to log.
- logfileout
-
returns filehandle to log.
- new_info($cinfo)
-
reset current song info.
- song_change($cinfo)
-
Run on song change
- update_info()
-
Run on poll
- monitor()
-
print current status to STDERR
- scrobble()
-
Scrobble current song
- run_commands()
-
Fork and run list of commands.
SEE ALSO
COPYRIGHT
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.
5 POD Errors
The following errors were encountered while parsing the POD:
- Around line 80:
You forgot a '=back' before '=head1'
- Around line 82:
'=item' outside of any '=over'
- Around line 238:
You forgot a '=back' before '=head1'
- Around line 241:
'=item' outside of any '=over'
- Around line 1046:
You forgot a '=back' before '=head1'