Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I just read about this command line Pandora player called pianobar Install pianobar

It works great but the homepage says "last.fm scrobbling (using an external scrobbler)"

Any one ever set this up before?

share|improve this question

3 Answers 3

up vote 8 down vote accepted
  1. First you'll need an external scrobbler. I recommend scrobbler-helper, which is written in Perl and available via CPAN.

    sudo perl -MCPAN -e 'install Audio::Scrobbler'
    
  2. Configure pianobar to use external scrobbler.

    Skip the next two steps if you already have a ~/.config/pianobar/config.

    • Create the configuration directory for pianobar,

      mkdir -p ~/.config/pianobar
      
    • Copy the example config file,

      cp /usr/share/doc/pianobar/contrib/config-example ~/.config/pianobar/config
      
    • Now in ~/.config/pianobar/config, remove the # from the beginning of this line:

      #event_command = /home/user/.config/pianobar/eventcmd
      

      and replace user with your actual username. This sets the path of the script that will be run every time you finish playing a song.

    • ~/.config/pianobar/eventcmd doesn't exist yet, so download this script to your Desktop. That script is the same as the one found in /usr/share/doc/pianobar/contrib/eventcmd.sh, but with some lines that required extra packages commented out. Once you have downloaded it, rename it to eventcmd then run the following commands:

      cp ~/Desktop/eventcmd ~/.config/pianobar/eventcmd
      chmod +x ~/.config/pianobar/eventcmd
      
  3. Configure scrobbler-helper,

    scrobbler-helper needs to know your Last.fm account and password.

    • Create a file ~/.scrobbler-helper.conf and paste the following into it:

      [global]
      username=USERNAME
      password=PASSWORD
      

      replacing USERNAME and PASSWORD with your actual Last.fm username and password.

share|improve this answer

Alternative solution: There is a Gtk application called Pithos that is built on libpiano (i.e., it uses the same backend as pianobar). You can set up last.fm scrobbling in the preferences.

Of course, if you prefer a command-line player this doesn't help you very much. But if what you're really looking for is a non-flash, desktop-based Pandora player, this may be perfect for you.

share|improve this answer

lastfmsubmitd is cool, because it will queue up scrobbles if the network is down.

Copying and pasting the following into bash should get you up and running.

sudo apt-get install pianobar lastfmsubmitd #install requirements
sudo usermod -a G lastfm $USER              #use `lastfmsubmitd` setup group
sudo /etc/init.d/lastfmsubmitd restart      #restart `lastfmsubmitd`
mkdir ~/.config/pianobar                    #setup config environment
cd ~/.config/pianobar
cp /usr/share/doc/pianobar/contrib/eventcmd.sh .
ed eventcmd.sh <<"EOF"                      #Add `lastfmsubmitd` support
10a
        songfinish)
                if [ -n "$songDuration" ] &&
                   [ $(echo "scale=4; ($songPlayed/$songDuration*100)>50" | bc) -eq 1 ] &&
                   [ "$rating" -ne 2 ]; then
                        /usr/lib/lastfmsubmitd/lastfmsubmit --artist "$artist" --title "$title" --album "$album" --length "$((songDuration/1000))"
                fi
                ;;
.
wq
EOF
echo "event_command = $HOME/.config/pianobar/eventcmd.sh" >> config

The eventcmd.sh part of the script is from Arnold French

EDIT: You may have to chmod +x eventcmd.sh.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.