Pull info from Pithos for Conky

I switched from pianobar to Pithos as pianobar didn’t work as well with conky as I would have liked. The script below lets me get information from Pithos that I can use in pianobar.

< ?php

$song=`dbus-send --print-reply --dest=net.kevinmehall.Pithos /net/kevinmehall/Pithos net.kevinmehall.Pithos.GetCurrentSong`;

$matches = array();

switch($argv[1]) {
	case 'album':
		$pattern = '~"album".*?"(.*?)".*~s';
	case 'title':
		$pattern = '~"title".*?"(.*?)".*~s';
	case 'artist':
		$pattern = '~"artist".*?"(.*?)".*~s';

preg_match($pattern, $song, $matches);

if($matches) {
	echo $matches[1];

Published by Brian

Application Developer at the University of Iowa. Works mostly with PHP/Oracle, but doesn't like the Oracle bits. Also an avid gamer and tinkerer.

10 replies on “Pull info from Pithos for Conky”

  1. Vastone, I used the following:

    sudo apt-get update
    sudo add-apt-repository ppa:ondrej/php5

    Then in conkyrc file:

    ${goto 50}${color white}${font augie:style=Bold:size=10}${execi 1 php /home/scottr99/pithosGet.php title -f -i title}$font$color
    ${goto 50}${color white}by:$color ${color white}${font augie:style=Bold:size=10}${execi 1 php /home/scottr99/pithosGet.php artist -f -i artist}$font$color
    ${goto 50}${color white}on:$color ${color white}${font augie:style=Bold:size=10}${execi 1 php /home/scottr99/pithosGet.php album -f -i album}$font$color

    let me know if you have a problem.

    1. for php I forgot one line, should read like this:

      sudo apt-get update
      sudo add-apt-repository ppa:ondrej/php5
      sudo apt-get install php5

      copy all lines in this order in a terminal.

      I just did it to my son’s computer, worked perfect.

  2. sorry, w/o the formatting:

    ${execi 1 php /home/scottr99/pithosGet.php title -f -i title}
    ${execi 1 php /home/scottr99/pithosGet.php artist -f -i artist}
    ${execi 1 php /home/scottr99/pithosGet.php album -f -i album}

  3. I know i’m kinda raising the dead here but im somewhat stuck. After i install php from the ppa and then insert the lines in the conkyrc i get the php script 3 times in text in my conky.

Comments are closed.