From 5f301e85b24f3a219c3020a8e24113c31a2a1058 Mon Sep 17 00:00:00 2001
From: jade (winter)
Date: Sun, 19 Jul 2026 17:51:11 +0100
Subject: fix so much stuff + add hls player
---
lib/bbcnext.php | 183 +++++++++++++++++++++++++++++---------------------------
1 file changed, 95 insertions(+), 88 deletions(-)
(limited to 'lib/bbcnext.php')
diff --git a/lib/bbcnext.php b/lib/bbcnext.php
index 988d248..ed58a4f 100644
--- a/lib/bbcnext.php
+++ b/lib/bbcnext.php
@@ -1,109 +1,116 @@
data);
+ next_renderExperience(rms_fetch($path)->data);
}
function next_renderExperience(array $modules) {
- foreach ($modules as $m) {
- next_renderModule($m);
- }
+ foreach ($modules as $m) {
+ next_renderModule($m);
+ }
}
function next_renderModule(stdClass $module) {
- $type = strtr($module->type, '_', '-');
- $titleTag = $type == 'inline-header-module' ? 'h1' : 'h2';
- echo "<$type id=\"$module->id\" module-style=\"$module->style\">";
- echo "<$titleTag>"
- . htmlspecialchars($module->title ?? '[no title]')
- . "$titleTag>";
- if (isset($module->description)) {
- echo ''
- . htmlspecialchars($module->description)
- . '';
- }
- echo '';
- if (!is_array($module->data)) {
- next_renderItem($module->data);
- } else {
- foreach ($module->data as $item) {
- next_renderItem($item);
- }
- }
- echo "$type>";
+ $type = strtr($module->type, '_', '-');
+ $titleTag = $type == 'inline-header-module' ? 'h1' : 'h2';
+ echo "<$type id=\"$module->id\" module-style=\"$module->style\">";
+ echo "<$titleTag>"
+ . htmlspecialchars($module->title ?? '[no title]')
+ . "$titleTag>";
+ if (isset($module->description)) {
+ echo ''
+ . htmlspecialchars($module->description)
+ . '';
+ }
+ echo '';
+ if (!is_array($module->data)) {
+ next_renderItem($module->data);
+ } else {
+ foreach ($module->data as $item) {
+ next_renderItem($item);
+ }
+ }
+ echo "";
+ if ($module->id == 'aod_play_area') {
+ $url = mediaselector_findHls($module->data[0]->id);
+ echo '';
+ echo '';
+ }
+ echo "$type>";
}
function next_renderItem(stdClass $item) {
- $type = strtr($item->type, '_', '-');
- $primaryTag = $type == 'segment-item' ? 'primary-title' : 'h3';
- echo "<$type id=\"$item->id\">";
- echo '';
- echo "<$primaryTag>"
- . htmlspecialchars($item->titles?->primary ?? '[no primary]')
- . "$primaryTag>";
- if (isset($item->network)) {
- echo ''
- . htmlspecialchars($item->network->short_title)
- . '';
- }
- echo '';
- if (isset($item->titles->secondary)) {
- echo ''
- . htmlspecialchars($item->titles->secondary)
- . '';
- }
- if (isset($item->titles->tertiary)) {
- echo ''
- . htmlspecialchars($item->titles->tertiary)
- . '';
- }
- echo '';
- if (isset($item->synopses?->short, $item->synopses?->medium)) {
- echo ''
- . htmlspecialchars($item->synopses->short)
- . '
'
- . htmlspecialchars($item->synopses->long ?? $item->synopses->medium)
- . ' ';
- } elseif (isset($item->synopses?->short)) {
- echo '' . htmlspecialchars($item->synopses->short)
- . '';
- }
+ $type = strtr($item->type, '_', '-');
+ $primaryTag = $type == 'segment-item' ? 'primary-title' : 'h3';
+ echo "<$type id=\"$item->id\">";
+ echo '';
+ echo "<$primaryTag>"
+ . htmlspecialchars($item->titles?->primary ?? '[no primary]')
+ . "$primaryTag>";
+ if (isset($item->network)) {
+ echo ''
+ . htmlspecialchars($item->network->short_title)
+ . '';
+ }
+ echo '';
+ if (isset($item->titles->secondary)) {
+ echo ''
+ . htmlspecialchars($item->titles->secondary)
+ . '';
+ }
+ if (isset($item->titles->tertiary)) {
+ echo ''
+ . htmlspecialchars($item->titles->tertiary)
+ . '';
+ }
+ echo '';
+ if (isset($item->synopses?->short, $item->synopses?->medium)) {
+ echo ''
+ . htmlspecialchars($item->synopses->short)
+ . '
'
+ . htmlspecialchars($item->synopses->long ?? $item->synopses->medium)
+ . ' ';
+ } elseif (isset($item->synopses?->short)) {
+ echo '' . htmlspecialchars($item->synopses->short)
+ . '';
+ }
- if (isset($item->item)) {
- next_renderItem($item->item);
- }
+ if (isset($item->item)) {
+ next_renderItem($item->item);
+ }
- if (isset($item->offset)) {
- echo ''
- . gmdate('H:i:s', $item->offset->start)
- . '';
- echo ''
- . gmdate('H:i:s', $item->offset->end)
- . '';
- }
+ if (isset($item->offset)) {
+ echo ''
+ . gmdate('H:i:s', $item->offset->start)
+ . '';
+ echo ''
+ . gmdate('H:i:s', $item->offset->end)
+ . '';
+ }
- if ($type == 'container-item') {
- $href = '?path=' . RMS_SOUNDS_CONTAINER . '/' . $item->urn;
- echo "View";
- } elseif ($type == 'playable-item') {
- $pid = explode(':', $item->urn)[4];
- $href = '?path=' . RMS_SOUNDS_PLAYABLE . '/' . $pid;
- echo "Listen";
- }
+ if ($type == 'container-item') {
+ $href = '?path=' . RMS_SOUNDS_CONTAINER . '/' . $item->urn;
+ echo "View";
+ } elseif ($type == 'playable-item') {
+ $pid = explode(':', $item->urn)[4];
+ $href = '?path=' . RMS_SOUNDS_PLAYABLE . '/' . $pid;
+ echo "Listen";
+ }
- foreach ($item->uris ?? [] as $uri) {
- if ($uri->type != 'link') continue;
- echo ''
- . htmlspecialchars($uri->label) . '';
- }
+ foreach ($item->uris ?? [] as $uri) {
+ if ($uri->type != 'link') continue;
+ echo ''
+ . htmlspecialchars($uri->label) . '';
+ }
- if (isset($item->download) && $item->download->type == 'non_drm') {
- $variant = $item->download->quality_variants->high;
- echo ''
- . "Download ($variant->label)";
- }
+ if (isset($item->download) && $item->download->type == 'non_drm') {
+ $variant = $item->download->quality_variants->high;
+ echo ''
+ . "Download ($variant->label)";
+ }
- echo "$type>";
+ echo "$type>";
}
--
cgit v1.3