$items) {
$channel = $channels[$channelId] ?? null;
if (!$channel) {
continue;
}
foreach ($items as $p) {
$start = $p['start'];
if (!$start instanceof DateTimeInterface) {
continue;
}
if ($start >= $now && $start <= $now->modify('+30 minutes')) {
$id = ProgrammeIndexBuilder::id($channelId, $start, $p['title'] ?? '', $p['stop'] ?? null);
ProgrammeIndexBuilder::add($programmeIndex, $id, $channelId, $channel, $p);
$upcoming[] = [
'id' => $id,
'channel_id' => $channelId,
'channel' => $channel,
'programme' => $p,
];
}
if (
$start->format('Y-m-d') === $now->format('Y-m-d')
&& $start->format('H:i') >= '20:00'
&& $start->format('H:i') <= '23:00'
) {
$id = ProgrammeIndexBuilder::id($channelId, $start, $p['title'] ?? '', $p['stop'] ?? null);
ProgrammeIndexBuilder::add($programmeIndex, $id, $channelId, $channel, $p);
$primetime[] = [
'id' => $id,
'channel_id' => $channelId,
'channel' => $channel,
'programme' => $p,
];
}
}
}
foreach ($currentProgrammes as $item) {
$id = ProgrammeIndexBuilder::id(
$item['channel_id'],
$item['start'],
$item['title'] ?? '',
$item['stop'] ?? null
);
ProgrammeIndexBuilder::add($programmeIndex, $id, $item['channel_id'], [
'name' => $item['channel_name'],
'number' => $item['channel_number'],
'favorite' => $item['favorite'],
], $item);
}
usort($upcoming, fn($a, $b) => $a['programme']['start'] <=> $b['programme']['start']);
usort($primetime, fn($a, $b) => $a['programme']['start'] <=> $b['programme']['start']);
$favoritesNow = array_values(array_filter(
$currentProgrammes,
fn($item) => !empty($item['favorite'])
));
?>
Dein Überblick für jetzt, gleich und heute Abend.TVGuide