Skip to content

Commit 8a4ccd8

Browse files
authored
Update playlist in opencast when changing metadata (#1098)
1 parent c8c1e75 commit 8a4ccd8

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

lib/Models/Playlists.php

+15-5
Original file line numberDiff line numberDiff line change
@@ -499,15 +499,25 @@ public function update(array $json)
499499
) {
500500
// Load playlist from Opencast
501501
$playlist_client = ApiPlaylistsClient::getInstance($this->config_id);
502-
$oc_playlist = $playlist_client->getPlaylist($this->service_playlist_id);
503502

504-
if ($oc_playlist) {
505-
self::checkPlaylistACL($oc_playlist, $this);
506-
} else {
507-
// Load or update failed in Opencast
503+
// Update playlist in Opencast
504+
$oc_update_data = [];
505+
foreach (['title', 'description', 'creator'] as $key) {
506+
if (array_key_exists($key, $json)) {
507+
$oc_update_data[$key] = $json[$key];
508+
}
509+
}
510+
511+
$oc_playlist = $playlist_client->updatePlaylist($this->service_playlist_id, $oc_update_data);
512+
513+
if (!$oc_playlist) {
514+
// Update failed in Opencast
508515
return false;
509516
}
510517

518+
// Ensure playlist acls are correct
519+
self::checkPlaylistACL($oc_playlist, $this);
520+
511521
// Ensure playlist data is consistent
512522
$json['title'] = $oc_playlist->title;
513523
$json['description'] = $oc_playlist->description;

0 commit comments

Comments
 (0)