Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Gets the currently playing song from Pithos.
#!/usr/bin/env python
# http://wiki.python.org/moin/DbusExamples
# You must initialize the gobject/dbus support for threading
# before doing anything.
import gobject
gobject.threads_init()
from dbus import glib
glib.init_threads()
# Create a session bus.
import dbus
try:
bus = dbus.SessionBus()
pithos_object = \
bus.get_object("net.kevinmehall.Pithos", "/net/kevinmehall/Pithos")
pithos = dbus.Interface(pithos_object, "net.kevinmehall.Pithos")
info = dict((str(k), str(v)) for k, v in pithos.GetCurrentSong().items())
except dbus.exceptions.DBusException:
print "(Nothing Playing)"
exit(0)
import sys
if len(sys.argv) > 1:
format = sys.argv[1]
else:
format = "%(title)s by %(artist)s"
print format % info
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.