First commit, imported from the working folder: Android TV app, loopback guide server, design sources and per-release verification notes. Includes the 0.16 tuning screen, built and tested but not yet confirmed on the box. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
19 lines
1.3 KiB
TypeScript
19 lines
1.3 KiB
TypeScript
export const SLOT_MS = 30 * 60 * 1000;
|
||
export const channels = [
|
||
{ number: 101, name: 'Orbit One', titles: ['The Midnight Observatory', 'Small Town, Big Orbit', 'Beyond the Blue', 'The Last Shuttle Home'] },
|
||
{ number: 202, name: 'Orbit Sci-Fi', titles: ['Signal from Europa', 'Starbound Dispatch', 'Visitors at Dawn', 'Station Nine'] },
|
||
{ number: 401, name: 'Orbit Kids', titles: ['Moonbug Rangers', 'The Comet Club', 'Rocket Pocket', 'Planet of Puzzles'] },
|
||
];
|
||
export function programme(channel: typeof channels[number], time: number) {
|
||
if (!Number.isSafeInteger(time) || Math.abs(time) > 8e15) throw new RangeError('Invalid timestamp');
|
||
const slot = Math.floor(time / SLOT_MS);
|
||
const index = ((slot % channel.titles.length) + channel.titles.length) % channel.titles.length;
|
||
const start = slot * SLOT_MS;
|
||
return { title: channel.titles[index], start, end: start + SLOT_MS, offsetMs: time - start };
|
||
}
|
||
export function guide(time = Date.now(), count = 6) {
|
||
if (!Number.isInteger(count) || count < 1 || count > 48) throw new RangeError('count must be 1–48');
|
||
return channels.map(channel => ({ number: channel.number, name: channel.name,
|
||
programmes: Array.from({ length: count }, (_, i) => ({ ...programme(channel, time + i * SLOT_MS), offsetMs: i === 0 ? programme(channel, time).offsetMs : 0 })) }));
|
||
}
|