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/configand should look like below:
$ nano ~/.mocpscrob/config
[scrobbler]
login=YOUR_LAST.FM_USERNAME
password=YOUR_LAST.FM-PASSWORD
streams=true
hostname=post.audioscrobbler.comReplace 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.pyand 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.pyNow, run MOC on other Terminal/ Shell, play a music and the Scrobbler works.
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
~/.bashrcfile.
$ nano ~/.bashrc
...
## alias for last.fm scrobbler on moc
alias mocp='python3 /usr/bin/mocp-scrobbler.py -d; mocp'- Run the following command
$ source ~/.bashrcEnjoy and share your favorite track to the world :)