Пример #1
0
    def make_taglist(self, tag, values):
        taglist = Gst.TagList.new_empty()

        for value in values:
            if isinstance(value, (GLib.Date, Gst.DateTime)):
                taglist.add_value(Gst.TagMergeMode.APPEND, tag, value)
                continue

            gobject_value = GObject.Value()
            if isinstance(value, bytes):
                gobject_value.init(GObject.TYPE_STRING)
                gobject_value.set_string(value)
            elif isinstance(value, int):
                gobject_value.init(GObject.TYPE_UINT)
                gobject_value.set_uint(value)
                gobject_value.init(GObject.TYPE_VALUE)
                gobject_value.set_value(value)
            else:
                raise TypeError
            taglist.add_value(Gst.TagMergeMode.APPEND, tag, gobject_value)

        return taglist
Пример #2
0
 def set_value(tag, value):
     gobject_value = GObject.Value()
     gobject_value.init(GObject.TYPE_STRING)
     gobject_value.set_string(value)
     taglist.add_value(Gst.TagMergeMode.REPLACE, tag, gobject_value)