diff --git a/lib/Models/REST/AdminNgEventClient.php b/lib/Models/REST/AdminNgEventClient.php deleted file mode 100644 index ccb5ca4c3..000000000 --- a/lib/Models/REST/AdminNgEventClient.php +++ /dev/null @@ -1,37 +0,0 @@ -serviceName . ': ' - . _('Die Opencast-Konfiguration wurde nicht korrekt angegeben')); - } - } - - /** - * Rtracts and deletes an episode with admin ng - * - * @param string $episode_id episode identifier - * - * @return bool success or not - */ - public function deleteEpisode($episode_id) - { - $response = $this->opencastApi->eventAdminNg->delete($episode_id); - - if (in_array($response['code'], [200, 202])) { - return true; - } - return false; - } -} diff --git a/lib/Models/REST/ApiEventsClient.php b/lib/Models/REST/ApiEventsClient.php index b0d9aea1b..9c4487dfa 100644 --- a/lib/Models/REST/ApiEventsClient.php +++ b/lib/Models/REST/ApiEventsClient.php @@ -74,30 +74,6 @@ public function setACL($episode_id, $acl) return $response['code'] == 200; } - /** - * Retrieves a list of episode based on defined parameters and pagination. - * This method is intended to be consumed by front end. - * By default api/event GET is responsible to get the episodes, - * however, when advance search is defined in config, lucene search will be used to get the episodes. - * - * @param string series_id Identifier for a Series - * @param string course_id Course ID - * - * @return array list of consumable episodes - */ - public function getEpisodes($series_id = null, $course_id = null) - { - $events = []; - - if ($this->advance_search) { - $events = $this->episodesLookupAdvanced($series_id, $course_id); - } else { - $events = $this->episodesLookup($series_id); - } - - return $events; - } - /** * Get all episodes from connected opencast based on defined parameters * @@ -116,57 +92,6 @@ public function getAll($params = []) return false; } - /** - * Generates Publication for a single event - * - * @param object $oc_event opencast event object - * @param object $s_event opencast search event object - * - * @return object $oc_event opencast event object with generate publication - */ - private function generatePublication($oc_event, $s_event) - { - $media = []; - - if (!isset($s_event->mediapackage->media->track)) { - return $oc_event; - } - - $tracks = is_array($s_event->mediapackage->media->track) - ? $s_event->mediapackage->media->track - : [$s_event->mediapackage->media->track]; - - foreach ($tracks as $track) { - $width = 0; - $height = 0; - if (!empty($track->video)) { - list($width, $height) = explode('x', $track->video->resolution); - $bitrate = $track->video->bitrate; - } else if (!empty($track->audio)) { - $bitrate = $track->audio->bitrate; - } - - $obj = new \stdClass(); - $obj->mediatype = $track->mimetype; - $obj->flavor = $track->type; - $obj->has_video = !empty($track->video); - $obj->has_audio = !empty($track->audio); - $obj->tags = $track->tags->tag; - $obj->url = $track->url; - $obj->duration = $track->duration; - $obj->bitrate = $bitrate; - $obj->width = $width; - $obj->height = $height; - - $media[] = $obj; - } - - $oc_event->publications[0]->attachments = $s_event->mediapackage->attachments->attachment; - $oc_event->publications[0]->media = $media; - - return $oc_event; - } - /** * Get all scheduled events * diff --git a/lib/Models/REST/ApiWorkflowsClient.php b/lib/Models/REST/ApiWorkflowsClient.php index 6e0d230fd..2bc3668f4 100644 --- a/lib/Models/REST/ApiWorkflowsClient.php +++ b/lib/Models/REST/ApiWorkflowsClient.php @@ -18,24 +18,6 @@ function __construct($config_id = 1) } } - /** - * Perform the "retract" workflow for an episode - * - * @param string $episode_id episode id - * - * @return boolean the status of the performed workflow - */ - public function retract($episode_id) - { - // TODO: configurable workflow for retracting - $response = $this->opencastApi->workflowsApi->run($episode_id, 'retract'); - - if ($response['code'] == 201) { - return true; - } - return false; - } - /** * Republish the passed episode / event * diff --git a/lib/Models/REST/IngestClient.php b/lib/Models/REST/IngestClient.php index 607ff006a..c501fb76a 100644 --- a/lib/Models/REST/IngestClient.php +++ b/lib/Models/REST/IngestClient.php @@ -53,44 +53,6 @@ public function addDCCatalog($mediaPackage, $dublinCore, $flavor = '') return false; } - /** - * Ingest the completed media package into the system, retrieving all URL-referenced files - * - * @param string $mediaPackage The media package - * @param string $workflowDefinitionId Workflow definition id. - * @param string $workflowInstanceId The workflow instance ID to associate this ingest with scheduled events. - * - * @return string augmented media package in xml format, or false if unable to add - */ - public function ingest($mediaPackage, $workflowDefinitionId = '', $workflowInstanceId = '') - { - $response = $this->opencastApi->ingest->ingest($mediaPackage, $workflowDefinitionId, $workflowInstanceId); - - if ($response['code'] == 200) { - return $response['body']; - } - return false; - } - - /** - * Add a media track to a given media package using an URL. - * - * @param string $mediaPackage The media package - * @param string $trackURI The location of the media - * @param string $flavor The kind of media track - * - * @return string augmented media package in xml format, or false if unable to add - */ - public function addTrack($mediaPackage, $trackURI, $flavor) - { - $response = $this->opencastApi->ingest->addTrackUrl($mediaPackage, $flavor, $trackURI); - - if ($response['code'] == 200) { - return $response['body']; - } - return false; - } - /** * Schedule an event based on the given media package. * diff --git a/lib/Models/REST/WorkflowClient.php b/lib/Models/REST/WorkflowClient.php index 142cab8bc..37bfd1677 100644 --- a/lib/Models/REST/WorkflowClient.php +++ b/lib/Models/REST/WorkflowClient.php @@ -20,53 +20,6 @@ public function __construct($config_id = 1) } - /** - * Get a specific workflow instance - * - * @param string $id The workflow instance identifier - * - * @return object|boolean A JSON representation of a workflow instance, or false when unable to get - */ - public function getWorkflowInstance($id) - { - $response = $this->opencastApi->workflow->getInstance($id); - - if ($response['code'] == 200) { - if (isset($response['body']->workflow)) { - return $response['body']->workflow; - } - } - - return false; - } - - /** - * Returns all Workflow instances for a given SeriesID - * - * @param string $series_id The series identifier - * - * @return array|boolean Workflow Instances, or false if unable to get - */ - public function getInstances($series_id = null) - { - $params = [ - 'count' => 1000, - 'compact' => true - ]; - - if (!empty($series_id)) { - $params['seriesId'] = $series_id; - } - - $response = $this->opencastApi->workflow->getInstances($params); - - if ($response['code'] == 200) { - return $response['body']; - } - - return false; - } - /** * Returns all available workflow definitions * @@ -85,24 +38,6 @@ public function getDefinitions() return false; } - /** - * Removes a workflow instance from connected Opencast - * - * @param string $id the workflow instance id - * - * @return boolean success or not - */ - public function removeInstanceComplete($id) - { - $response = $this->opencastApi->workflow->removeInstance($id); - - if (in_array($response['code'], [204, 404])) { - return true; - } - - return false; - } - #################### # HELPER FUNCTIONS # #################### diff --git a/lib/Models/Videos.php b/lib/Models/Videos.php index 94d029f6b..ab8f693ef 100644 --- a/lib/Models/Videos.php +++ b/lib/Models/Videos.php @@ -631,14 +631,17 @@ public function updateMetadata($event) if (in_array($response['code'], [200, 204]) === true) { $api_wf_client = ApiWorkflowsClient::getInstance($this->config_id); - if($api_wf_client->republish($this->episode)) { + + if ($api_wf_client->republish($this->episode)) { $success = true; $store_data = []; + foreach ($allowed_metadata_fields as $field_name) { if (isset($event[$field_name])) { $store_data[$field_name] = $event[$field_name]; } } + if (!empty($store_data)) { $this->setData($store_data); $success = $this->store() !== false; diff --git a/lib/VersionHelper.php b/lib/VersionHelper.php index 61d9038a1..29e08942e 100644 --- a/lib/VersionHelper.php +++ b/lib/VersionHelper.php @@ -97,8 +97,6 @@ function registerCoursewareBlock(\StudipPlugin $plugin) require_once(__DIR__ . '/Versions/4.6/OCConfig.php'); require_once(__DIR__ . '/Versions/4.6/OpencastLTI.php'); require_once(__DIR__ . '/Versions/4.6/LtiLink.php'); - require_once(__DIR__ . '/Versions/4.6/OCCourseModel.php'); - require_once(__DIR__ . '/Versions/4.6/SearchClient.php'); } } diff --git a/lib/Versions/4.6/OCCourseModel.php b/lib/Versions/4.6/OCCourseModel.php deleted file mode 100644 index c9b5b54f3..000000000 --- a/lib/Versions/4.6/OCCourseModel.php +++ /dev/null @@ -1,54 +0,0 @@ -context_id = $context_id; - - } - - public function getEpisodesForRest() - { - // fake filter request, use course id - $request = [ - 'limit' => -1, - 'order' => 'created_desc', - 'cid' => $this->context_id - ]; - - // get available playlists for this course - $seminar_playlists = new \SimpleCollection(PlaylistSeminars::findBySeminar_id($this->context_id)); - - $playlist_ids = $seminar_playlists->pluck('playlist_id'); - - if (!empty($playlist_ids)) { - $videos = Videos::findBySQL('LEFT JOIN oc_playlist_video AS opv - ON (opv.video_id = id AND opv.playlist_id IN ('. implode(', ', $playlist_ids) .')) - WHERE opv.playlist_id IS NOT NULL - GROUP BY oc_video.id ORDER BY oc_video.created desc', - [ - ':seminar_id' => $this->context_id - ] - ); - } else { - $videos = []; - } - - $ret = []; - foreach ($videos as $video) { - $vid = $video->toSanitizedArray(); - $vid['id'] = $vid['episode']; - $ret[] = $vid; - } - - return $ret; - } -} \ No newline at end of file diff --git a/lib/Versions/4.6/SearchClient.php b/lib/Versions/4.6/SearchClient.php deleted file mode 100644 index 688afa6e4..000000000 --- a/lib/Versions/4.6/SearchClient.php +++ /dev/null @@ -1,43 +0,0 @@ -context_id = $context_id; - } - - public function getBaseURL() - { - if (!$this->context_id) { - return ''; - } - - $series = SeminarSeries::findOneBySeminar_id($this->context_id); - - if ($series) { - $ep = Endpoints::findOneBySQL("service_type ='search' AND config_id = ?", [$series->config_id]); - - if ($ep) { - $url = parse_url($ep['service_url']); - - return $url['scheme'] . '://' . $url['host'] - . ($url['port'] ? ':' . $url['port'] : ''); - } - } - - return ''; - } -} \ No newline at end of file