Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 0 additions & 1 deletion bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
StudipAutoloader::addAutoloadPath(__DIR__ . '/lib', 'Opencast');

// adding observer
NotificationCenter::addObserver('Opencast\Models\Videos', 'addToCoursePlaylist', 'OpencastCourseSync');
NotificationCenter::addObserver('Opencast\Models\Videos', 'parseEvent', 'OpencastVideoSync');
NotificationCenter::addObserver('Opencast\Models\Videos', 'checkEventACL', 'OpencastVideoSync');
NotificationCenter::addObserver('Opencast\Models\VideosUserPerms', 'setPermissions', 'OpencastVideoSync');
Expand Down
1 change: 0 additions & 1 deletion bootstrap_migrations.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
StudipAutoloader::addAutoloadPath(__DIR__ . '/lib', 'Opencast');

// adding observer
NotificationCenter::addObserver('Opencast\Models\Videos', 'addToCoursePlaylist', 'OpencastCourseSync');
NotificationCenter::addObserver('Opencast\Models\Videos', 'parseEvent', 'OpencastVideoSync');
NotificationCenter::addObserver('Opencast\Models\Videos', 'checkEventACL', 'OpencastVideoSync');
NotificationCenter::addObserver('Opencast\Models\VideosUserPerms', 'setPermissions', 'OpencastVideoSync');
8 changes: 8 additions & 0 deletions cronjobs/opencast_discover_videos.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,10 @@ public function execute($last_result, $parameters = array())
$video = Videos::findOneBySql("episode = ?", [$current_event->identifier]);
$is_livestream = (bool) $video->is_livestream ?? false;

// Set a flag to determine a new state of the video!
$is_new = false;
if (!$video) {
$is_new = true;
$video = new Videos;
}

Expand All @@ -160,6 +163,11 @@ public function execute($last_result, $parameters = array())

self::parseEvent($current_event, $video);

// Make sure the new videos are only get processed by the add to course playlist.
if ($is_new) {
Videos::addToCoursePlaylist($current_event, $video);
}

// remove video from checklist for playlist videos (if even present)
unset($playlist_videos[$current_event->identifier]);
}
Expand Down
11 changes: 4 additions & 7 deletions lib/Models/Videos.php
Original file line number Diff line number Diff line change
Expand Up @@ -1190,18 +1190,15 @@ public function reportVideo($description)
}


/**
/**
* Assigns a video to the seminar if the video belongs to the seminar' series
*
* @Notification OpencastVideoSync
*
* @param string $eventType
* @param object $episode
* @param Opencast\Models\Video $video
* @param object $episode the opencast episode object
* @param Opencast\Models\Video $video the Stud.IP video record
*
* @return void
*/
public static function addToCoursePlaylist($eventType, $episode, $video)
public static function addToCoursePlaylist($episode, $video)
{
// check if a series is assigned to this event
if (!isset($episode->is_part_of) || empty($episode)) {
Expand Down
4 changes: 2 additions & 2 deletions lib/Routes/Playlist/PlaylistAddVideos.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function __invoke(Request $request, Response $response, $args)

$data = $this->getRequestData($request);
$video_tokens = $data['videos'];
$course_id = $data['course_id'];
$course_id = $data['course_id'] ?? null;

$videos = array_map(function ($token) {
return Videos::findOneByToken($token);
Expand Down Expand Up @@ -64,4 +64,4 @@ public function __invoke(Request $request, Response $response, $args)

return $response->withStatus(204);
}
}
}