Skip to content

Commit

Permalink
Fix duplicate entries in playlist
Browse files Browse the repository at this point in the history
  • Loading branch information
dennis531 committed Dec 5, 2024
1 parent 34181c6 commit 8d5a503
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions lib/Routes/Playlist/PlaylistAddVideos.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function __invoke(Request $request, Response $response, $args)
]);

if (!$oc_playlist) {
throw new Error(_('Wiedergabeliste kontte nicht zu Opencast hinzugefügt werden!'), 500);
throw new Error(_('Wiedergabeliste konnte nicht zu Opencast hinzugefügt werden!'), 500);
}

$playlist->service_playlist_id = $oc_playlist->id;
Expand All @@ -80,18 +80,13 @@ public function __invoke(Request $request, Response $response, $args)

if (!$video->episode) continue;

$entries[] = [
'contentId' => $video->episode,
'type' => 'EVENT'
];

// Only add video if not contained in entries
$entry_exists = current(array_filter($entries, function($e) use ($video) {
return $e->contentId === $video->episode;
}));

if (!$entry_exists) {
$entries[] = [
$entries[] = (object) [
'contentId' => $video->episode,
'type' => 'EVENT'
];
Expand Down

0 comments on commit 8d5a503

Please sign in to comment.