我正在尝试将一些 pygtk 音乐播放器代码移植到使用 gst 的发现器模块的 pygi。
from gi.repository import Gst, GstPbutils
def on_discovered(discoverer, ismedia):
print("%s -- %s" %( discoverer.tags.get('title', 'Unknown'),
discoverer.tags.get('artist', 'Unknown')))
Gst.init(None)
location = "file:///srv/Music/molly_hatchet-the_creeper.mp3"
discoverer = GstPbutils.Discoverer()
discoverer.discover_uri(location)
discoverer.connect('discovered', on_discovered)
当我尝试运行它时,我收到以下错误:
/usr/lib/python2.7/dist-packages/gi/types.py:43: Warning: g_object_get_qdata: assertion `G_IS_OBJECT (object)' failed
return info.invoke(*args, **kwargs)
/usr/lib/python2.7/dist-packages/gi/types.py:43: Warning: g_object_ref_sink: assertion `G_IS_OBJECT (object)' failed
return info.invoke(*args, **kwargs)
** (python:21482): CRITICAL **: pygobject_register_wrapper: assertion `PyObject_TypeCheck(self, &PyGObject_Type)' failed
/usr/lib/python2.7/dist-packages/gi/types.py:43: Warning: g_object_unref: assertion `G_IS_OBJECT (object)' failed
return info.invoke(*args, **kwargs)
不幸的是,关于这个 pygi 模块的文档似乎有点稀疏。