def __init__(self, filter_node): self.mlt_service_id = filter_node.getAttribute(ID) try: self.multipart_filter = ( filter_node.getAttribute(MULTIPART_FILTER) == "true") except: # default is False self.multipart_filter = False try: self.mlt_drop_version = filter_node.getAttribute(MLT_DROP_VERSION) except: self.mlt_drop_version = None try: self.mlt_min_version = filter_node.getAttribute(MLT_MIN_VERSION) except: self.mlt_min_version = None self.xml = filter_node.toxml() self.name = filter_node.getElementsByTagName(NAME).item( 0).firstChild.nodeValue self.group = filter_node.getElementsByTagName(GROUP).item( 0).firstChild.nodeValue # Properties saved as name-value-type tuplets p_node_list = filter_node.getElementsByTagName(PROPERTY) self.properties = propertyparse.node_list_to_properties_array( p_node_list) # Property args saved in propertyname -> propertyargs_string dict self.property_args = propertyparse.node_list_to_args_dict(p_node_list) # Multipart property describes how filters are created and edited when filter # constists of multiple filters. # There 0 or 1 of these in the info object. node_list = filter_node.getElementsByTagName(MULTIPART_PROPERTY) if len(node_list) == 1: mp = node_list[0] value = mp.firstChild.nodeValue args = mp.getAttribute(ARGS) start_property = mp.getAttribute(MULTIPART_START) end_property = mp.getAttribute(MULTIPART_END) self.multipart_desc = (args, start_property, end_property) self.multipart_value = value # Extra editors that handle properties that have been set "no_editor" e_node_list = filter_node.getElementsByTagName(EXTRA_EDITOR) self.extra_editors = propertyparse.node_list_to_extraeditors_array( e_node_list) # Non-MLT properties are persistent values like properties that values are not directly written out as MLT properties p_node_list = filter_node.getElementsByTagName(NON_MLT_PROPERTY) self.non_mlt_properties = propertyparse.node_list_to_non_mlt_properties_array( p_node_list) # Property args for Non-MLT properties saved in propertyname -> propertyargs_string dict self.property_args.update( propertyparse.node_list_to_args_dict(p_node_list))
def __init__(self, filter_node): self.mlt_service_id = filter_node.getAttribute(ID) try: self.multipart_filter = (filter_node.getAttribute(MULTIPART_FILTER) == "true") except: # default is False self.multipart_filter = False try: self.mlt_drop_version = filter_node.getAttribute(MLT_DROP_VERSION) except: self.mlt_drop_version = None try: self.mlt_min_version = filter_node.getAttribute(MLT_MIN_VERSION) except: self.mlt_min_version = None self.xml = filter_node.toxml() self.name = filter_node.getElementsByTagName(NAME).item(0).firstChild.nodeValue self.group = filter_node.getElementsByTagName(GROUP).item(0).firstChild.nodeValue # Properties saved as name-value-type tuplets p_node_list = filter_node.getElementsByTagName(PROPERTY) self.properties = propertyparse.node_list_to_properties_array(p_node_list) # Property args saved in propertyname -> propertyargs_string dict self.property_args = propertyparse.node_list_to_args_dict(p_node_list) # Multipart property describes how filters are created and edited when filter # constists of multiple filters. # There 0 or 1 of these in the info object. node_list = filter_node.getElementsByTagName(MULTIPART_PROPERTY) if len(node_list) == 1: mp = node_list[0] value = mp.firstChild.nodeValue args = mp.getAttribute(ARGS) start_property = mp.getAttribute(MULTIPART_START) end_property = mp.getAttribute(MULTIPART_END) self.multipart_desc = (args, start_property, end_property) self.multipart_value = value # Extra editors that handle properties that have been set "no_editor" e_node_list = filter_node.getElementsByTagName(EXTRA_EDITOR) self.extra_editors = propertyparse.node_list_to_extraeditors_array(e_node_list) # Non-MLT properties are persistent values like properties that values are not directly written out as MLT properties p_node_list = filter_node.getElementsByTagName(NON_MLT_PROPERTY) self.non_mlt_properties = propertyparse.node_list_to_non_mlt_properties_array(p_node_list) # Property args for Non-MLT properties saved in propertyname -> propertyargs_string dict self.property_args.update(propertyparse.node_list_to_args_dict(p_node_list))