Skip to content
This repository has been archived by the owner on Feb 25, 2024. It is now read-only.

Commit

Permalink
moved high-/lowres to "internal video player" config, adjusted langvars
Browse files Browse the repository at this point in the history
  • Loading branch information
Theodor Truffer committed Mar 15, 2019
1 parent e91865a commit bc20ceb
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 28 deletions.
13 changes: 6 additions & 7 deletions classes/Conf/class.xoctConfFormGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ protected function initEventsSection() {
$this->addItem($cb);


// INTERNAL VIDEO PLAYER
$cb = new ilCheckboxInputGUI($this->parent_gui->txt(xoctConf::F_INTERNAL_VIDEO_PLAYER), xoctConf::F_INTERNAL_VIDEO_PLAYER);
$cb->setInfo($this->parent_gui->txt(xoctConf::F_INTERNAL_VIDEO_PLAYER . '_info'));
$this->addItem($cb);
Expand All @@ -245,6 +246,11 @@ protected function initEventsSection() {
$te->setRequired(true);
$cbs->addSubItem($te);

$cbs = new ilCheckboxInputGUI($this->parent_gui->txt(xoctConf::F_USE_HIGHLOWRESSEGMENTPREVIEWS), xoctConf::F_USE_HIGHLOWRESSEGMENTPREVIEWS);
$cbs->setInfo($this->parent_gui->txt(xoctConf::F_USE_HIGHLOWRESSEGMENTPREVIEWS . '_info'));
$cbs->setRequired(false);
$cb->addSubItem($cbs);


$cb = new ilCheckboxInputGUI($this->parent_gui->txt(xoctConf::F_USE_MODALS), xoctConf::F_USE_MODALS);
$cb->setInfo($this->parent_gui->txt(xoctConf::F_USE_MODALS . '_info'));
Expand Down Expand Up @@ -304,13 +310,6 @@ protected function initEventsSection() {
$ro = new ilRadioOption($this->parent_gui->txt(xoctConf::F_SCHEDULED_METADATA_EDITABLE . '_' . xoctConf::METADATA_EXCEPT_DATE_PLACE), xoctConf::METADATA_EXCEPT_DATE_PLACE);
$ri->addOption($ro);
$this->addItem($ri);


$cb = new ilCheckboxInputGUI($this->parent_gui->txt(xoctConf::F_USE_HIGHLOWRESSEGMENTPREVIEWS), xoctConf::F_USE_HIGHLOWRESSEGMENTPREVIEWS);
$cb->setInfo($this->parent_gui->txt(xoctConf::F_USE_HIGHLOWRESSEGMENTPREVIEWS . '_info'));
$cb->setRequired(false);
$this->addItem($cb);

}


Expand Down
39 changes: 26 additions & 13 deletions classes/Event/class.xoctEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ public function getThumbnailUrl() {
);
$i = 0;
while (!$this->thumbnail_url && $i < count($possible_publications)) {
$url = $this->getPublicationMetadataForUsage(xoctPublicationUsage::find($possible_publications[$i]))->getUrl();
$url = $this->getFirstPublicationMetadataForUsage(xoctPublicationUsage::find($possible_publications[$i]))->getUrl();
if (xoctConf::getConfig(xoctConf::F_SIGN_THUMBNAIL_LINKS)) {
$this->thumbnail_url = xoctSecureLink::sign($url);
} else {
Expand All @@ -576,7 +576,7 @@ public function getThumbnailUrl() {
*/
public function getAnnotationLink() {
if (!isset($this->annotation_url)) {
$url = $this->getPublicationMetadataForUsage(xoctPublicationUsage::find(xoctPublicationUsage::USAGE_ANNOTATE))->getUrl();
$url = $this->getFirstPublicationMetadataForUsage(xoctPublicationUsage::find(xoctPublicationUsage::USAGE_ANNOTATE))->getUrl();
if (xoctConf::getConfig(xoctConf::F_SIGN_ANNOTATION_LINKS)) {
$this->annotation_url = xoctSecureLink::sign($url);
} else {
Expand All @@ -594,7 +594,7 @@ public function getAnnotationLink() {
*/
public function getPlayerLink() {
if (!isset($this->player_url)) {
$url = $this->getPublicationMetadataForUsage(xoctPublicationUsage::find(xoctPublicationUsage::USAGE_PLAYER))->getUrl();
$url = $this->getFirstPublicationMetadataForUsage(xoctPublicationUsage::find(xoctPublicationUsage::USAGE_PLAYER))->getUrl();
if (xoctConf::getConfig(xoctConf::F_SIGN_PLAYER_LINKS)) {
$this->player_url = xoctSecureLink::sign($url);
} else {
Expand All @@ -611,7 +611,7 @@ public function getPlayerLink() {
*/
public function getDownloadLink() {
if (!isset($this->download_url)) {
$url = $this->getPublicationMetadataForUsage(xoctPublicationUsage::find(xoctPublicationUsage::USAGE_DOWNLOAD))->getUrl();
$url = $this->getFirstPublicationMetadataForUsage(xoctPublicationUsage::find(xoctPublicationUsage::USAGE_DOWNLOAD))->getUrl();
if (xoctConf::getConfig(xoctConf::F_SIGN_DOWNLOAD_LINKS)) {
$this->download_url = xoctSecureLink::sign($url);
} else {
Expand All @@ -630,7 +630,7 @@ public function getCuttingLink() {
if (!isset($this->cutting_url)) {
$url = str_replace('{event_id}', $this->getIdentifier(), xoctConf::getConfig(xoctConf::F_EDITOR_LINK));
if (!$url) {
$url = $this->getPublicationMetadataForUsage(xoctPublicationUsage::find(xoctPublicationUsage::USAGE_CUTTING))->getUrl();
$url = $this->getFirstPublicationMetadataForUsage(xoctPublicationUsage::find(xoctPublicationUsage::USAGE_CUTTING))->getUrl();
}
if (!$url) {
$base = rtrim(xoctConf::getConfig(xoctConf::F_API_BASE), "/");
Expand All @@ -648,50 +648,63 @@ public function getCuttingLink() {
/**
* @param $xoctPublicationUsage
*
* @return xoctPublication
* @return array
*/
public function getPublicationMetadataForUsage($xoctPublicationUsage) {
if (!$xoctPublicationUsage instanceof xoctPublicationUsage) {
return new xoctPublication();
return [new xoctPublication()];
}
/**
* @var $xoctPublicationUsage xoctPublicationUsage
* @var $attachment xoctAttachment
* @var $media xoctMedia
*/
$medias = array();
$attachments = array();
$medias = [];
$attachments = [];
foreach ($this->getPublications() as $publication) {
if ($publication->getChannel() == $xoctPublicationUsage->getChannel()) {
$medias = array_merge($medias, $publication->getMedia());
$attachments = array_merge($attachments, $publication->getAttachments());
}
}
$return = [];
switch ($xoctPublicationUsage->getMdType()) {
case xoctPublicationUsage::MD_TYPE_ATTACHMENT:
foreach ($attachments as $attachment) {
if ($attachment->getFlavor() == $xoctPublicationUsage->getFlavor()) {
return $attachment;
$return[] = $attachment;
}
}
break;
case xoctPublicationUsage::MD_TYPE_MEDIA:
foreach ($medias as $media) {
if ($media->getFlavor() == $xoctPublicationUsage->getFlavor()) {
return $media;
$return[] = $media;
}
}
break;
case xoctPublicationUsage::MD_TYPE_PUBLICATION_ITSELF:
foreach ($this->getPublications() as $publication) {
if ($publication->getChannel() == $xoctPublicationUsage->getChannel()) {
return $publication;
$return[] = $publication;
}
}
break;
default:
return [new xoctPublication()];
}
return $return;
}


return new xoctPublication();
/**
* @param $xoctPublicationUsage
*
* @return mixed|xoctPublication
*/
public function getFirstPublicationMetadataForUsage($xoctPublicationUsage) {
$metadata = $this->getPublicationMetadataForUsage($xoctPublicationUsage);
return count($metadata) ? array_shift($metadata) : new xoctPublication();
}


Expand Down
12 changes: 8 additions & 4 deletions classes/Event/class.xoctEventGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ public function streamVideo() {
$this->cancel();
}

$publication_player = $xoctEvent->getPublicationMetadataForUsage(xoctPublicationUsage::getUsage(xoctPublicationUsage::USAGE_PLAYER));
$publication_player = $xoctEvent->getFirstPublicationMetadataForUsage(xoctPublicationUsage::getUsage(xoctPublicationUsage::USAGE_PLAYER));

// Multi stream
$medias = array_values(array_filter($publication_player->getMedia(), function (xoctMedia $media) {
Expand Down Expand Up @@ -567,9 +567,13 @@ public function streamVideo() {
}, $medias);

$segmentFlavor = xoctPublicationUsage::find(xoctPublicationUsage::USAGE_SEGMENTS)->getFlavor();
$publication_segments = $xoctEvent->getPublicationMetadataForUsage(xoctPublicationUsage::getUsage(xoctPublicationUsage::USAGE_SEGMENTS));
$publication_usage_segments = xoctPublicationUsage::getUsage(xoctPublicationUsage::USAGE_SEGMENTS);
$attachments =
$publication_usage_segments->getMdType() == xoctPublicationUsage::MD_TYPE_PUBLICATION_ITSELF ?
$xoctEvent->getFirstPublicationMetadataForUsage($publication_usage_segments)->getAttachments() :
$xoctEvent->getPublicationMetadataForUsage($publication_usage_segments);

$segments = array_filter($publication_segments->getAttachments(), function (xoctAttachment $attachment) use ( &$segmentFlavor) {
$segments = array_filter($attachments, function (xoctAttachment $attachment) use ( &$segmentFlavor) {
return strpos($attachment->getFlavor(), $segmentFlavor) !== FALSE;
});

Expand Down Expand Up @@ -672,7 +676,7 @@ protected function deliverVideo() {
$event_id = $_GET['event_id'];
$mid = $_GET['mid'];
$xoctEvent = xoctEvent::find($event_id);
$media = $xoctEvent->getPublicationMetadataForUsage(xoctPublicationUsage::getUsage(xoctPublicationUsage::USAGE_PLAYER))->getMedia();
$media = $xoctEvent->getFirstPublicationMetadataForUsage(xoctPublicationUsage::getUsage(xoctPublicationUsage::USAGE_PLAYER))->getMedia();
foreach ($media as $medium) {
if ($medium->getId() == $mid) {
$url = $medium->getUrl();
Expand Down
4 changes: 2 additions & 2 deletions lang/ilias_de.lang
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ config_scheduled_metadata_editable_2#:#Alle, außer Datum und Aufnahmestation
config_segment_tag#:#Segment-preview-Tag
config_segment_tag_info#:#Benutze den Tag für das Filtern der Segment-Previews
config_use_highlowres_segment_preview#:#High- und Low-Resolution Previews nutzen.
config_use_highlowres_segment_preview_info#:#(Kein Opencast-Default-Verhalten, muss konfiguriert sein)
config_use_highlowres_segment_preview_info#:#Standardmässig in Opencast deaktiviert, muss konfiguriert werden.
config_video_portal_title#:#Bezeichung des externen Videoportals
config_video_portal_link#:#Link zu externem Videoportal
config_video_portal_link_info#:#Wird in den Einstellungen und im Infotab einer Serie angezeigt. Als Platzhalter kann &#123series_id} verwendet werden. Bsp: https://myopencast-tube.com/cast/channels/&#123series_id}
Expand Down Expand Up @@ -237,7 +237,7 @@ publication_usage_title#:#Titel
publication_usage_type_annotate#:#Annotationen
publication_usage_type_api#:#API
publication_usage_type_cutting#:#Cutting-Tool
publication_usage_type_segments#:#Segments Preview Flavor
publication_usage_type_segments#:#Segments
publication_usage_type_player#:#Player
publication_usage_type_thumbnail#:#Vorschaubild
publication_usage_update#:#Aktualisieren
Expand Down
4 changes: 2 additions & 2 deletions lang/ilias_en.lang
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ config_scheduled_metadata_editable_2#:#All, except date and recording station.
config_segment_tag#:#Segment-preview-Tag
config_segment_tag_info#:#Use Tag for filtering the segment-previews
config_use_highlowres_segment_preview#:#High- and low-resolution previews.
config_use_highlowres_segment_preview_info#:#(No Opencast-default-Behaviour)
config_use_highlowres_segment_preview_info#:#Deactivated by default, must be configured in Opencast
config_video_portal_title#:#Title of external Video Portal
config_video_portal_link#:#Link to external Video Portal
config_video_portal_link_info#:#Will be displayed in the settings and info tab of a series. &#123series_id} can be used as a placeholder. E.g.: https://myopencast-tube.com/cast/channels/&#123series_id}
Expand Down Expand Up @@ -239,7 +239,7 @@ publication_usage_title#:#Title
publication_usage_type_annotate#:#Annotate
publication_usage_type_api#:#API
publication_usage_type_cutting#:#Cutting-Tool
publication_usage_type_segments#:#Segments Preview Flavor
publication_usage_type_segments#:#Segments Preview
publication_usage_type_player#:#Player
publication_usage_type_thumbnail#:#Thumbnail
publication_usage_update#:#Update
Expand Down

0 comments on commit bc20ceb

Please sign in to comment.