Riky Lutfi Hamzah

@rilutham

Convey to the people even if it were a single sentence. (Sahih al-Bukhari 3461)

LinkedIn Github Twitter Goodreads Last.fm

Are you a big fan of MOC? - So do I. MOC (music on console) is a console audio player for Linux/ UNIX. Some people are always calling it mocp which is actually it’s binary file name. Like other audio players such as Rhythmbox and Nightingale, MOC can also scrobbled playing track information to your Last.fm account. Here are an instructions to set up Last.fm scrobbler for MOC :

You need python3 installed on your computer.

  • Create configuration file on ~/.mocpscrob/config and should look like below:
$ nano ~/.mocpscrob/config 

[scrobbler]
login=YOUR_LAST.FM_USERNAME
password=YOUR_LAST.FM-PASSWORD
streams=true
hostname=post.audioscrobbler.com

Replace login and password value with your Last.fm account. Don’t worry, password will be replaced with password_md5 when the following python script run.

  • Download mocp-scrobbler.py and put this python script to your $PATH.
# Download `mocp-scrobbler.py`
$ git clone https://github.com/fluxid/mocp-scrobbler.git

# Check your $PATH
$ echo $PATH
/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/git/bin

# Move `mocp-scrobbler.py` to $PATH 
$ sudo mv mocp-scrobbler/mocp-scrobbler.py /usr/bin
  • Run the python script
$ python3 -d /usr/bin/mocp-scrobbler.py

Now, run MOC on other Terminal/ Shell, play a music and the Scrobbler works.

mocp scrobbler
"Now Playing" notification on Last.fm profile.

How to Start Scrobbler with MOC?

If you want to start Scrobbler automatically when MOC is running, you can make a simple custom alias.

  • Add an alias to last line of ~/.bashrc file.
$ nano ~/.bashrc

...
## alias for last.fm scrobbler on moc
alias mocp='python3 /usr/bin/mocp-scrobbler.py -d; mocp'
  • Run the following command
$ source ~/.bashrc

Enjoy and share your favorite track to the world :)

Your turn to share:


comments powered by Disqus