use of org.opencastproject.metadata.api.MediaPackageMetadata in project opencast by opencast.
the class WorkflowServiceImpl method populateMediaPackageMetadata.
/**
* Reads the available metadata from the dublin core catalog (if there is one) and updates the mediapackage.
*
* @param mp
* the media package
*/
protected void populateMediaPackageMetadata(MediaPackage mp) {
if (metadataServices.size() == 0) {
logger.warn("No metadata services are registered, so no media package metadata can be extracted from catalogs");
return;
}
for (MediaPackageMetadataService metadataService : metadataServices) {
MediaPackageMetadata metadata = metadataService.getMetadata(mp);
MediaPackageMetadataSupport.populateMediaPackageMetadata(mp, metadata);
}
}
use of org.opencastproject.metadata.api.MediaPackageMetadata in project opencast by opencast.
the class DublinCoreTest method testMediaPackageMetadataExtraction.
@Test
public void testMediaPackageMetadataExtraction() throws Exception {
// Load the DC catalog
FileInputStream in = null;
DublinCoreCatalog catalog = null;
try {
in = new FileInputStream(catalogFile);
catalog = service.load(in);
} finally {
IOUtils.closeQuietly(in);
}
// Create a mediapackage containing the DC catalog
MediaPackage mp = MediaPackageBuilderFactory.newInstance().newMediaPackageBuilder().createNew();
mp.add(catalogFile.toURI(), Catalog.TYPE, MediaPackageElements.EPISODE);
mp.add(catalogFile2.toURI(), Catalog.TYPE, MediaPackageElements.SERIES);
MediaPackageMetadata metadata = service.getMetadata(mp);
assertEquals("Mediapackage metadata title not extracted from DC properly", catalog.getFirst(DublinCore.PROPERTY_TITLE), metadata.getTitle());
}
Aggregations