Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use true instead of 1 for api bool parameters #26

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading