To make manipulating metadata easier we attach specific tags to the most commonly used metadata properties extracted from a file. Some metadata standards can have quite a complex structure. Moreover, in most cases, one image, video or document contains more than one metadata packages. Using tags you can search for desirable properties with a few lines of code without even knowing the exact format of the loaded file.
The code sample below demonstrates how to search for specific metadata properties using tags:
Load a file to examine
Make up a predicate checking that a specific tag is assigned to a property (alternatively you can use a combination of tags)
Pass the predicate to the findProperties method
Iterate through the found properties
basic_usage.FindMetadataProperties
# Fetch all the properties satisfying the predicate:# property contains the name of the last document editor OR the date/time the document was last modifiedwithgm.Metadata(constants.input_pptx)asmetadata:specification=gm.search.ContainsTagSpecification(gm.tagging.Tags.person.editor).either(gm.search.ContainsTagSpecification(gm.tagging.Tags.time.modified))properties=metadata.find_properties(specification)forpropertyinproperties:print(f"Property name: {property.name}, Property value: {property.value}")
As a result, we obtain all metadata properties containing the name of the person last edited the document and all properties that store the date/time the document was last edited.
For more information on supported features of the GroupDocs.Metadata search engine please refer to the following articles: