Search in sources :

Example 1 with MediaPackageMetadata

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);
    }
}
Also used : MediaPackageMetadata(org.opencastproject.metadata.api.MediaPackageMetadata) MediaPackageMetadataService(org.opencastproject.metadata.api.MediaPackageMetadataService)

Example 2 with MediaPackageMetadata

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());
}
Also used : MediaPackageMetadata(org.opencastproject.metadata.api.MediaPackageMetadata) MediaPackage(org.opencastproject.mediapackage.MediaPackage) FileInputStream(java.io.FileInputStream) Test(org.junit.Test)

Aggregations

MediaPackageMetadata (org.opencastproject.metadata.api.MediaPackageMetadata)2 FileInputStream (java.io.FileInputStream)1 Test (org.junit.Test)1 MediaPackage (org.opencastproject.mediapackage.MediaPackage)1 MediaPackageMetadataService (org.opencastproject.metadata.api.MediaPackageMetadataService)1