You need to use the event command interface. From the man page:

An example script can be found in the contrib/ directory of pianobar's source distribution.

~/.config/pianobar:

user = <username> password = <password> (although I'd suggest password_command) event_command = ~/.config/pianobar/event_command.py

~/config/event_command.py

#!/usr/bin/env python import os import sys from os.path import expanduser, join path = os.environ.get('XDG_CONFIG_HOME') if not path: path = expanduser("~/.config") else: path = expanduser(path) fn = join(path, 'pianobar', 'nowplaying') info = sys.stdin.readlines() cmd = sys.argv[1] if cmd == 'songstart': with open(fn, 'w') as f: f.write("".join(info))

This will write the song information to ~/.config/pianobar/nowplaying when a new song starts (there are other events available in the manpage). You can then parse that using your choice of tools to acquire the song title.