Skip to content

Commit

Permalink
remove unused stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
tgloeggl committed May 17, 2024
1 parent 9dd9dcd commit df9da78
Show file tree
Hide file tree
Showing 9 changed files with 4 additions and 333 deletions.
37 changes: 0 additions & 37 deletions lib/Models/REST/AdminNgEventClient.php

This file was deleted.

75 changes: 0 additions & 75 deletions lib/Models/REST/ApiEventsClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand All @@ -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
*
Expand Down
18 changes: 0 additions & 18 deletions lib/Models/REST/ApiWorkflowsClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down
38 changes: 0 additions & 38 deletions lib/Models/REST/IngestClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down
65 changes: 0 additions & 65 deletions lib/Models/REST/WorkflowClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand All @@ -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 #
####################
Expand Down
5 changes: 4 additions & 1 deletion lib/Models/Videos.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 0 additions & 2 deletions lib/VersionHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
}

Expand Down
54 changes: 0 additions & 54 deletions lib/Versions/4.6/OCCourseModel.php

This file was deleted.

0 comments on commit df9da78

Please sign in to comment.