The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

musicmpdscrobble

musicmpdscrobble - Perl script to submit tracks to Last.FM from mpd

SYNOPSIS

        musicmpdscrobble --monitor --logfile=STDERR

        This runs musicmpdscrobble in the foreground and prints a nifty little monitor summery.

OPTIONS

--daemonize

Run as a daemon. You should set the logfile option if you use this! Note: There is no way to set this option in the config file.

--kill

Kill running process if daemonized. Should work, let me know if it doesn't.

--pidfile

Specify a pid file for daemon mode.

--logfile="/path/to/log/file"

Specify a log file. Set to STDERR or STDOUT for terminal output.

--monitor

Print program status while running. Don't use in daemon mode!

--verbose=n

Set verbosity level of the log (0 through 4)

--config

Set path to config file (default /etc/musicmpdscrobble.conf)

--help

Print summery of command options and quit.

longhelp

Print this.

CONFIGURATION FILE

The configuration file is a perl program. It is evaluated after the script runs, so it is a good idea to run perl -c /etc/musicmpdscrobble.conf after editing it. Here is an example config file:

        #!/usr/bin/perl 
        # Example musicmpdscrobble.conf file
        #
        # This is a perl file.  It must be a hash reference.  This means a comma between 
        # key / value pairs.
        #
        # To check syntax run perl -c musicmpdscrobble.conf
        #

        { 
        # LastFM Username and Password
                lastfm_username   => "riemann42", 
                #lastfm_password   => "secret", 
                lastfm_md5password   => "md5 hash of password here", 

        # Specify mpd_server info.  Default is MPD_HOST or localhost
        #       mpd_server => 'localhost',

        # Specify mpd_port.  Default is MPD_PORT or 6600
        #       mpd_port        => 6600,

        # If you have installed the Music::Tag module, set to 1.
                musictag          => 0,

        # Specify the music_directory path for MPD. 
                music_directory           => "/mnt/media/music/MP3s",

        # Set the verbosity level.  1 through 4.  3 is a good medium 
                verbose           => 3, 

        #Specify the logfile path
                logfile           => "/var/log/musicmpdscrobble.log",

        #Specify the file to write the pid to.
                pidfile => "/var/run/musicmpdscrobble.pid",

        #Specify the file to store pending scrobbles in.
                scrobble_queue    =>  "/var/lib/musicmpdscrobble.queue",

        #Automatically get missing mbid info:
        #       get_mbid_from_mb  => 1,         

        # list of programs to run when a song start.  Accepts the following variables:
        #
        #   %f  filename
        #   %a  Artist
        #   %b  Album
        #   %t  Title
        #   %l  Length of track in seconds
        #   %n  Track number
        #   %m  mbid of track
        #
        #   runonstart => [],

        # list of programs to run after song submit.
        #          runonsubmit => [],
        }; 

About Music::Tag Module

The music tag module is framework for reading tag files. It requires several modules be installed to work correctly.

The major reason to install this is that it will read info from the filename and not just from the MPD database. You can, therefore, submit the MusicBrainz ID, if it is available via Music::Tag. You want to submit the MusicBrainz Track ID because at the momement it makes you immune from last.fm spam protection and helps improve the last.fm database.

CLIENT ID

This is BETA code. It does, however, have an official last.fm client id of "MAM." It is not developed by the last.fm folks, and is not guranteed to even work.

SEE ALSO

Music::Audioscrobbler::MPD, Music::Tag

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.