use of org.vitrivr.cineast.core.data.providers.primitive.NothingProvider in project cineast by vitrivr.
the class EXIFMetadataExtractor method extract.
/**
* Extracts the metadata from the specified path and returns a List of MediaObjectMetadataDescriptor objects (one for each metadata entry).
*
* @param objectId ID of the multimedia object for which metadata will be generated.
* @param path Path to the file for which metadata should be extracted.
* @return List of MultimediaMetadataDescriptors. The list may be empty but must always be returned!
*/
@Override
public List<MediaObjectMetadataDescriptor> extract(String objectId, Path path) {
ExifSubIFDDirectory md = MetadataUtil.getMetadataDirectoryOfType(path, ExifSubIFDDirectory.class);
if (md == null) {
return Collections.emptyList();
}
Set<Entry<String, Object>> set = Maps.transformValues(FIELDS, md::getObject).entrySet();
return set.stream().filter(e -> e.getValue() != null).map(e -> MediaObjectMetadataDescriptor.of(objectId, this.domain(), e.getKey(), e.getValue())).filter(e -> !(e.getValueProvider() instanceof NothingProvider)).collect(Collectors.toList());
}
Aggregations