我目前正在研究API的另一个原因,我需要检索正在播放的路径或位置,我偶然发现了这个问题。
首先,您需要激活D-Bus服务插件(编辑->插件),它将公开
org.mpris.Totem
服务然后在
/Player
org.freedesktop.MediaPlayer
PositionGet()
方法检索当前位置。
totem.props.current_time
你刚才说的。
下面是一些代码:
import dbus
T_SERVICE_NAME = "org.mpris.Totem"
T_OBJECT_PATH = "/Player"
T_INTERFACE = "org.freedesktop.MediaPlayer"
session_bus= dbus.SessionBus()
totem = session_bus.get_object(T_SERVICE_NAME, T_OBJECT_PATH)
totem_mediaplayer = dbus.Interface(totem, dbus_interface=T_INTERFACE)
print totem_mediaplayer.PositionGet()
org.gnome.Totem
工具书类
-
http://git.gnome.org/browse/totem/tree/src/plugins/dbusservice/dbusservice.py
-
http://developer.gnome.org/totem/stable/TotemObject.html