Posted By

foursixnine on 04/11/09


Tagged

Shell Bash python script commandline exaile


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

o0110o


Get exaile's current song through dbus from commandline


 / Published in: Python
 

URL: http://blog.santiago.zarate.net.ve/

  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. # Simple script to get the current song being played by
  4. # exaile.
  5. # Author: Santiago Zarate <santiago [at] zarate [dot] net [dot] ve>
  6. # Blog: http://blog.santiago.zarate.net.ve
  7. #
  8.  
  9. import sys, dbus
  10.  
  11. bus = dbus.SessionBus()
  12.  
  13. try:
  14. remote_object = bus.get_object("org.exaile.DBusInterface","/DBusInterfaceObject")
  15. iface = dbus.Interface(remote_object, "org.exaile.DBusInterface")
  16. if(iface.status() == 'playing'):
  17. message = '%s - %s - %s ' % (iface.get_title(), iface.get_album(), iface.get_artist())
  18. else:
  19. message = 'Exaile is not playing'
  20.  
  21. except dbus.exceptions.DBusException, e:
  22. message = 'Exaile is not running: %s' % e
  23.  
  24. print message

Report this snippet  

You need to login to post a comment.