use of org.opencastproject.mediapackage.Publication in project opencast by opencast.
the class LiveScheduleServiceImpl method addLivePublicationChannel.
void addLivePublicationChannel(Organization currentOrg, MediaPackage mp) throws LiveScheduleException {
logger.debug("Adding live channel publication element to media package {}", mp);
String engageUrlString = null;
String playerPath = null;
if (currentOrg != null) {
engageUrlString = StringUtils.trimToNull(currentOrg.getProperties().get(ENGAGE_URL_PROPERTY));
playerPath = StringUtils.trimToNull(currentOrg.getProperties().get(PLAYER_PROPERTY));
}
if (engageUrlString == null) {
engageUrlString = serverUrl;
logger.info("Using 'server.url' as a fallback for the non-existing organization level key '{}' for the publication url", ENGAGE_URL_PROPERTY);
}
if (playerPath == null)
playerPath = DEFAULT_PLAYER_PATH;
try {
// Create new distribution element
URI engageUri = URIUtils.resolve(new URI(engageUrlString), playerPath + "?id=" + mp.getIdentifier().compact());
Publication publicationElement = PublicationImpl.publication(UUID.randomUUID().toString(), CHANNEL_ID, engageUri, MimeTypes.parseMimeType("text/html"));
mp.add(publicationElement);
} catch (URISyntaxException e) {
throw new LiveScheduleException(e);
}
}
use of org.opencastproject.mediapackage.Publication in project opencast by opencast.
the class PublicationBuilderPlugin method newElement.
@Override
public MediaPackageElement newElement(Type type, MediaPackageElementFlavor flavor) {
Publication element = new PublicationImpl();
element.setFlavor(flavor);
return element;
}
use of org.opencastproject.mediapackage.Publication in project opencast by opencast.
the class PublicationBuilderPlugin method elementFromURI.
@Override
public MediaPackageElement elementFromURI(URI uri) throws UnsupportedElementException {
// TODO Auto-generated method stub
logger.trace("Creating publication element from " + uri);
Publication publication = new PublicationImpl();
publication.setURI(uri);
return publication;
}
use of org.opencastproject.mediapackage.Publication in project opencast by opencast.
the class EventsEndpointTest method getExamplePublications.
@Ignore
private List<Publication> getExamplePublications() throws URISyntaxException {
List<Publication> publications = new ArrayList<Publication>();
Publication youtubePublication = PublicationImpl.publication("youtube-pub-id", "youtube", new URI("http://youtube.com/id"), MimeType.mimeType("you", "tube"));
publications.add(youtubePublication);
Publication internalPublication = PublicationImpl.publication("internal-pub-id", InternalPublicationChannel.CHANNEL_ID, new URI("http://internal.com/id"), MimeType.mimeType("in", "ternal"));
publications.add(internalPublication);
return publications;
}
use of org.opencastproject.mediapackage.Publication in project opencast by opencast.
the class EventsEndpointTest method testGetEventsJsonResponse.
@Ignore
@Test
public void testGetEventsJsonResponse() throws Exception {
String eventJson = IOUtils.toString(getClass().getResource("/events.json"));
String acceptHeader = "application/" + ApiVersion.CURRENT_VERSION.toExternalForm() + "+" + ApiFormat.JSON;
List<IndexObject> events = new ArrayList<IndexObject>();
List<String> contributors = new ArrayList<String>();
contributors.add("Physics Department");
List<Publication> publications = getExamplePublications();
Event event1 = new Event("e6aeb8df-a852-46cd-8128-b89de696f20e", defaultOrg.getId());
event1.setArchiveVersion(2L);
event1.setCreated("2015-03-12T10:38:54Z");
event1.setCreator("Opencast Administrator");
event1.setContributors(contributors);
event1.setDescription("Cooling without moving parts and using only heat as an input");
event1.setDuration(7200000L);
event1.setHasPreview(true);
event1.setLocation("physics-e-01");
List<String> presenters = new ArrayList<String>();
presenters.add("Prof. A. Einstein");
event1.setPresenters(presenters);
event1.setPublications(publications);
event1.setWorkflowState(WorkflowState.SUCCEEDED);
event1.setRecordingStartDate("2015-03-20T04:00:00Z");
event1.setSubject("Space Final Frontier");
event1.setTitle("Einstein refrigerator");
events.add(event1);
Event event2 = new Event("f5aeb8df-a852-46cd-8128-b89de696f20e", defaultOrg.getId());
event2.setArchiveVersion(5L);
event2.setCreated("2015-03-12T10:38:54Z");
event2.setCreator("Opencast Administrator");
event2.setContributors(contributors);
event2.setDescription("The history of the universe from the big bang to black holes");
event2.setDuration(7200000L);
event2.setHasPreview(true);
event2.setLocation("physics-e-02");
presenters = new ArrayList<String>();
presenters.add("Prof. Stephen Hawking");
event2.setPresenters(presenters);
event2.setPublications(publications);
event2.setWorkflowState(WorkflowState.SUCCEEDED);
event2.setRecordingStartDate("2015-03-20T04:00:00Z");
event2.setSubject("Space Final Frontier, Mathematics");
event2.setTitle("The Theory of Everything");
events.add(event2);
EventsEndpoint endpoint = new EventsEndpoint();
Response result = endpoint.getJsonEvents(acceptHeader, events, false, false, false, false);
assertTrue(result.getMetadata().get("Content-Type") != null);
assertEquals("application/v1.0.0+json", result.getMetadata().get("Content-Type").get(0).toString().toLowerCase());
assertThat(eventJson, SameJSONAs.sameJSONAs(result.getEntity().toString()).allowingAnyArrayOrdering());
}
Aggregations