JinnFire

True Grime.

Music on Console: MoC for *nix – Updated

#! introduced me to MoC and I’ve always liked console music players but never found one that I was totally happy with. After some tinkering I’ve got MoC setup with my Acer’s multimedia keys, showing it’s playlist in Conky and scrobbling to Last.Fm.

While it may lack some of the “features” of Banshee or Exaile for example, it’s elegant super functional and handles my music the way I like.

Console based Music on Console player on my Crunchbang Linux desktop w/ Conky on the right

Console based Music on Console player on my Crunchbang Linux desktop w/ Conky on the right

Setting up MoCp to submit to Last.Fm.

Install lastfmsubmitd via apt-get:
sudo apt-get install lastfmsubmitid

You can also get it here: http://www.red-bean.com/decklin/lastfmsubmitd/

Add the followign to ~/.moc/config:
OnSongChange = “/usr/lib/lastfmsubmitd/lastfmsubmit –artist %a –title %t –length %d –album %b”

Add lastfm your login info to/etc/lastfmsubmitd.conf
sudo nano /etc/lastfmsubmitid.conf

That’s it!

Showing output of MoC in Conky:

Add the following to your .conkyrc
${alignc}${color1}${execpi 1 mocp -Q %state}${color}
${color1}Song: ${color2}${alignr}${execpi 1 mocp -Q %song}${color}
${color1}Artist: ${color2}${alignr}${execpi 1 mocp -Q %artist}${color}
${color1}Album: ${color2}${alignr}${execpi 1 mocp -Q %album}${color}
${color1}Time: ${color2}${alignr}${execpi 1 mocp -Q %tl} / ${execpi 1 mocp -Q %tt}${color}

Below is my original line, I’ve recently switched to using the line above as it allows for more customization.
${color1}${execpi 1 mocp -i | head | egrep -v ‘SongTitle|File:|TotalSec|CurrentSec|CurrentTime’}

You can read the mocp man page to find alternate values to show.

Conky does have it’s own variables for MOCP however I found on Ubuntu/Crunchbang the output is unreliable at times, and flickers on screen.

Share and Enjoy:
  • Facebook
  • Global Grind
  • Identi.ca
  • MySpace
  • Twitter

4 Responses to “Music on Console: MoC for *nix – Updated”

  1. fast says:

    Hi
    Where can I get the wallpaper in the screenshot?
    is it zatoichi & yojimbo ? … need it !!1

    thx a lot

  2. Brandon says:

    Hey jinn, I tried out this script:

    # #!/bin/bash
    #
    # INFO=`mocp –info`
    #
    # if [ "$INFO" == "State: STOP" ];
    # then
    #
    # echo -n “”
    #
    # else
    #
    # ARTISTA=`mocp –info | grep Artist | cut -f2 -d :`
    # TITULO=`mocp –info | grep SongTitle | cut -f2 -d :`
    #
    # expr substr “$ARTISTA – $TITULO” 1 42
    #
    # fi

    but unfortunately when the song changes, it doesnt update the display in conky. any sugestions?

    • jinnstar says:

      This works for me from within the conky config (ie: .conkyrc) no external script needed.

      ${if_running mocp}${alignc}${color1}${execpi 1 mocp -Q %state}${color}
      ${color1}Song: ${color2}${alignr}${execpi 1 mocp -Q %song}${color}
      ${color1}Artist: ${color2}${alignr}${execpi 1 mocp -Q %artist}${color}
      ${color1}Album: ${color2}${alignr}${execpi 1 mocp -Q %album}${color}
      ${color1}Time: ${color2}${alignr}${execpi 1 mocp -Q %tl} / ${execpi 1 mocp -Q %tt}${color}
      ${color1}File: ${color2}${alignr}${execpi 1 mocp -Q %file}${color}
      ${else}Not Playing${endif}

Leave a Reply