从命令行通过dbus获取exail&ŧ039;的当前歌曲
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了从命令行通过dbus获取exail&ŧ039;的当前歌曲相关的知识,希望对你有一定的参考价值。
#!/usr/bin/env python # -*- coding: utf-8 -*- # Simple script to get the current song being played by # exaile. # Author: Santiago Zarate <santiago [at] zarate [dot] net [dot] ve> # Blog: http://blog.santiago.zarate.net.ve # import sys, dbus bus = dbus.SessionBus() try: remote_object = bus.get_object("org.exaile.DBusInterface","/DBusInterfaceObject") iface = dbus.Interface(remote_object, "org.exaile.DBusInterface") if(iface.status() == 'playing'): message = '%s - %s - %s ' % (iface.get_title(), iface.get_album(), iface.get_artist()) else: message = 'Exaile is not playing' except dbus.exceptions.DBusException, e: message = 'Exaile is not running: %s' % e print message
以上是关于从命令行通过dbus获取exail&ŧ039;的当前歌曲的主要内容,如果未能解决你的问题,请参考以下文章
使用TextMate&ŧ039;的tmŧdialog命令创建用户定义的菜单