Get exaile's current song through dbus from commandline


/ Published in: Python
Save to your folder(s)



Copy this code and paste it in your HTML
  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

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

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.