Skip to content

Commit 8794a67

Browse files
committed
Merge branch 'main' into issue-1374
2 parents bb9a171 + 5d9bda9 commit 8794a67

File tree

6 files changed

+17
-14
lines changed

6 files changed

+17
-14
lines changed

bootstrap.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
StudipAutoloader::addAutoloadPath(__DIR__ . '/lib', 'Opencast');
44

55
// adding observer
6-
NotificationCenter::addObserver('Opencast\Models\Videos', 'addToCoursePlaylist', 'OpencastCourseSync');
76
NotificationCenter::addObserver('Opencast\Models\Videos', 'parseEvent', 'OpencastVideoSync');
87
NotificationCenter::addObserver('Opencast\Models\Videos', 'checkEventACL', 'OpencastVideoSync');
98
NotificationCenter::addObserver('Opencast\Models\VideosUserPerms', 'setPermissions', 'OpencastVideoSync');

bootstrap_migrations.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
StudipAutoloader::addAutoloadPath(__DIR__ . '/lib', 'Opencast');
44

55
// adding observer
6-
NotificationCenter::addObserver('Opencast\Models\Videos', 'addToCoursePlaylist', 'OpencastCourseSync');
76
NotificationCenter::addObserver('Opencast\Models\Videos', 'parseEvent', 'OpencastVideoSync');
87
NotificationCenter::addObserver('Opencast\Models\Videos', 'checkEventACL', 'OpencastVideoSync');
98
NotificationCenter::addObserver('Opencast\Models\VideosUserPerms', 'setPermissions', 'OpencastVideoSync');

cronjobs/opencast_discover_videos.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,10 @@ public function execute($last_result, $parameters = array())
137137
$video = Videos::findOneBySql("episode = ?", [$current_event->identifier]);
138138
$is_livestream = (bool) $video->is_livestream ?? false;
139139

140+
// Set a flag to determine a new state of the video!
141+
$is_new = false;
140142
if (!$video) {
143+
$is_new = true;
141144
$video = new Videos;
142145
}
143146

@@ -155,6 +158,11 @@ public function execute($last_result, $parameters = array())
155158

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

161+
// Make sure the new videos are only get processed by the add to course playlist.
162+
if ($is_new) {
163+
Videos::addToCoursePlaylist($current_event, $video);
164+
}
165+
158166
// remove video from checklist for playlist videos (if even present)
159167
unset($playlist_videos[$current_event->identifier]);
160168
}

lib/Models/Videos.php

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1195,18 +1195,15 @@ public function reportVideo($description)
11951195
}
11961196

11971197

1198-
/**
1198+
/**
11991199
* Assigns a video to the seminar if the video belongs to the seminar' series
12001200
*
1201-
* @Notification OpencastVideoSync
1202-
*
1203-
* @param string $eventType
1204-
* @param object $episode
1205-
* @param Opencast\Models\Video $video
1201+
* @param object $episode the opencast episode object
1202+
* @param Opencast\Models\Video $video the Stud.IP video record
12061203
*
12071204
* @return void
12081205
*/
1209-
public static function addToCoursePlaylist($eventType, $episode, $video)
1206+
public static function addToCoursePlaylist($episode, $video)
12101207
{
12111208
// check if a series is assigned to this event
12121209
if (!isset($episode->is_part_of) || empty($episode)) {

lib/Routes/Playlist/PlaylistAddVideos.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public function __invoke(Request $request, Response $response, $args)
2525

2626
$data = $this->getRequestData($request);
2727
$video_tokens = $data['videos'];
28-
$course_id = $data['course_id'];
28+
$course_id = $data['course_id'] ?? null;
2929

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

6565
return $response->withStatus(204);
6666
}
67-
}
67+
}

package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)