Skip to content

Commit

Permalink
Merge pull request #26 from justusdieckmann/fix/api-bool-parameters
Browse files Browse the repository at this point in the history
Use true instead of 1 for api bool parameters
  • Loading branch information
NinaHerrmann authored Mar 19, 2024
2 parents 980511b + 31adca8 commit e52450c
Showing 1 changed file with 6 additions and 14 deletions.
20 changes: 6 additions & 14 deletions lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -246,20 +246,13 @@ private function add_video_published_data($ocinstanceid, $video) {
return false;
}

$api = new api($ocinstanceid);

// Use sign=true parameter to get signed URLs when Opencasts URL signing is turned on. sign=true does not harm when turned off.
$query = '/api/events/' . $video->identifier . '/publications?sign=true';
$result = $api->oc_get($query);
$publications = json_decode($result);

if (empty($publications)) {
if (empty($video->publications)) {
return false;
}

$useplayerurl = self::get_option('opencast_playerurl');

foreach ($publications as $publication) {
foreach ($video->publications as $publication) {

if ($publication->channel == $channelid) {

Expand All @@ -269,14 +262,13 @@ private function add_video_published_data($ocinstanceid, $video) {
// Add a url to video.
if ($useplayerurl) {
$video->url = $publication->url;
return true;
} else {
if (!$publication->media || !$this->add_video_url_and_title($publication, $video)) {
return false;
}
return $publication->media && $this->add_video_url_and_title($publication, $video);
}
}
}
return true;
return false;
}

/**
Expand All @@ -300,7 +292,7 @@ private function get_course_videos($courseid) {

$seriesfilter = "series:" . $seriesid;

$query = '/api/events?sign=1&withmetadata=1&withpublications=1&filter=' . urlencode($seriesfilter);
$query = '/api/events?sign=true&withmetadata=true&withpublications=true&filter=' . urlencode($seriesfilter);
try {
$api = new api($ocinstanceid);
$seriesvideos = $api->oc_get($query);
Expand Down

0 comments on commit e52450c

Please sign in to comment.