Skip to content

Commit 39a5a86

Browse files
committed
chore: Updates for the get_simple_data_table endpoint
Cast ID as string since players prefer a string for EPG channel ID (could be something like `bbc.one` for example). Bump days to fetch to 8 (go back 4 instead of 3 days into the past). Hopefully helps with #642
1 parent 09d5485 commit 39a5a86

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

app/Http/Controllers/XtreamApiController.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1489,7 +1489,7 @@ public function handle(Request $request)
14891489
$isCurrentProgramme = $startTime->lte($now) && $endTime->gt($now);
14901490

14911491
$epgListings[] = [
1492-
'id' => $programme['id'] ?? $count,
1492+
'id' => (string) ($programme['id'] ?? $count),
14931493
'epg_id' => (string) $epg->id,
14941494
'title' => $programme['title'] ?? '',
14951495
'lang' => $programme['lang'] ?? 'en',
@@ -1539,11 +1539,11 @@ public function handle(Request $request)
15391539
}
15401540

15411541
// Get programmes for several days to ensure we have enough data
1542-
// Start from 3 days ago to cover past programmes as well
1543-
// We fetch 7 days total (3 past, today, 3 future)
1544-
$daysToFetch = 7;
1542+
// Start from 4 days ago to cover past programmes as well
1543+
// We fetch 8 days total (4 past, today, 3 future)
1544+
$daysToFetch = 8;
15451545
$allProgrammes = [];
1546-
$threeDaysAgo = Carbon::now()->subDays(3);
1546+
$threeDaysAgo = Carbon::now()->subDays(value: 4);
15471547
foreach (range(0, $daysToFetch - 1) as $dayOffset) {
15481548
$date = $threeDaysAgo->clone()->addDays($dayOffset)->format('Y-m-d');
15491549
$programmes = $cacheService->getCachedProgrammes($epg, $date, [$channel->epgChannel->channel_id]);
@@ -1564,7 +1564,7 @@ public function handle(Request $request)
15641564
$isCurrentProgramme = $startTime->lte($now) && $endTime->gt($now);
15651565

15661566
$epgListings[] = [
1567-
'id' => $programme['id'] ?? $index,
1567+
'id' => (string) ($programme['id'] ?? $index),
15681568
'epg_id' => (string) $epg->id,
15691569
'title' => base64_encode($programme['title'] ?? ''),
15701570
'description' => base64_encode($programme['desc'] ?? ''),

0 commit comments

Comments
 (0)