def boot(): from shuffler.core import log log.init() from dbus.mainloop.glib import DBusGMainLoop DBusGMainLoop(set_as_default=True)
def set_status(self, message): self._call_proxy_method("set_status", message) def get_status(self): self._call_proxy_method("get_status") def now_playing(self, obj, media): if self._np_timeout: gobject.source_remove(self._np_timeout) self._np_timeout = gobject.timeout_add(1, self._now_playing, media) def _now_playing(self, media): self._current_media = media self.set_status(self.message_template % media) self._np_timeout = None return False if __name__ == "__main__": import sys log.init() message = sys.argv[-1] bus = dbus.SessionBus() manager = ImStatusManager(bus,"") print "saved state: ", manager.save_status() print "current: ", manager.get_status() manager.set_status(message) print "new: ", manager.get_status()