Start quick (the Director builds it from a line, or a collection by name) or
custom. One search for titles, collections, networks and genres. A collection
page with Add all, Refine by type and age, and a note while it's still being
read. The day in folding parts with how full each is, star and move in place.
Review where style, hours and dates can change, the week in hours, balance,
clashes, and two endings that never interrupt: Create & watch next on <room>,
or Create channel. The action bar stays at the foot; long lists scroll and
picks are kept. More: faces for who's watching, the Director with a count,
channel tiles, and settings as a short list.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
<div class="small">${pr.current?esc(pr.current.name)+' is watching on the TV.':'Nobody chosen yet on the TV.'}${kids?' Making channels and the Director are for Adult.':''}</div>`:'';
if(kids)returnhead('More')+who+`<div class="label">About</div><div class="card small">Orbit Companion runs on the TV itself, over your home Wi-Fi. It works while Orbit is open on the TV.</div>`;
${!yours||yours.next?'<button class="btn gold" data-create="1" style="margin-bottom:8px">+ Create a channel</button>':'<div class="small">Every number from 701 to 799 is taken.</div>'}
${standalone()?'':'<button class="line" data-home="1">Add to home screen <span>One tap to the remote</span></button>'}
<div class="label">Look</div>
<div class="chips" style="flex-wrap:wrap"><button class="${keptLook()?'':'on'}" data-look="">Follow this TV${state.now?.look?' ('+esc(state.now.look.name)+')':''}</button>
<div class="small">Following the TV, each room's remote wears that room's look. Pick one to keep it on this phone instead, whatever the TV is set to.</div>
<div class="label">About</div><div class="card small">Orbit Companion runs on the TV itself, over your home Wi-Fi. Nothing to install, no account. It works while Orbit is open on the TV.
To stop this phone, remove it in Settings › Rooms and phones.</div>`;
${pr.pinSet?'<span class="small" style="margin-left:auto;align-self:center">Adult needs the PIN</span>':''}</div>`;
if(kids)returnh+`<div class="card small" style="margin-top:14px">Kids is watching. Making channels and the Director are for Adult.</div>`;
constwaiting=state.directorCount;
h+=`<button class="ch" data-director="1" style="margin-top:16px;background:var(--raised)"><div class="grow"><div class="what">Director's Chair</div><div class="then">${waiting?'Ideas and titles waiting for you':'Suggestions for your channels'}</div></div>
<div class="small">${esc((c.styleTitle||'').replace(' by the Director',''))} · ${c.on?'on':'off'}</div><div class="small" style="color:var(--accent);font-weight:700;margin-top:8px">Edit</div></button>`).join('')}
${!yours||yours.next?`<button data-create="1" aria-label="Create a channel" style="flex:0 0 ${yours?.channels?.length?'64px':'100%'};border:2px dashed var(--accent);border-radius:16px;color:var(--accent);font-size:${yours?.channels?.length?'28px':'16px'};font-weight:700;padding:14px">${yours?.channels?.length?'+':'+ Create a channel'}</button>`:''}</div>`;
// Create a channel (phase 3, from design/companion v2): five steps, Name, Shows, Style, Hours and Review, in the TV's look.
// It saves through the same route as before, so the TV makes it exactly as Settings › Create your own does.
constSTYLES=[['Shaped','Shaped by the Director',"Recommended. Daytime, evening and late, like Orbit's own channels, with your core shows more often"],['Standard','Standard TV',"Shows take turns all day, episodes in order"],['Shuffled','Shuffled','Episodes in a mixed order, every one before any repeats'],
// Create a channel, refined (Paul, 7 November 2026, design/companion/build-create-v3.py): start quick (the Director builds it)
// or custom; one search for titles, collections, networks and genres; a collection page; the day in folding parts; and a
// review where anything can be changed and two endings that never interrupt what's on. Long lists scroll; the action bar
// stays at the foot and picks are kept. It saves through the same route as before.
constSTYLES=[['Shaped','Shaped by the Director',"Daytime, evening and late, like Orbit's own channels, with your core shows more often"],['Standard','Standard TV',"Shows take turns all day, episodes in order"],['Shuffled','Shuffled','Episodes in a mixed order, every one before any repeats'],
['Blocks','Blocks','A timetable: each show at its own times, every day'],['Marathon','Marathon','One show at a time, several episodes back to back']];
constHOURS=[[null,'All day'],[{from:18,to:0},'Evenings, 18:00 to midnight'],[{from:6,to:12},'Mornings, 06:00 to noon'],[{from:9,to:17},'Daytime, 09:00 to 17:00']];
body=`<div class="title" style="margin-top:14px">Name it</div><div class="small">It goes in Yours${d.number?' as '+d.number:''}. Keep it short, like 90s Sci-Fi.</div>
:'<div class="small">Your Emby collections show here once Orbit has read them.</div>'}
${c.colInfo?`<div class="card small" style="margin-top:8px">${c.colInfo.found} of ${c.colInfo.total} in ${esc(c.collection)} are in your library copy.${c.colInfo.complete?'':' <b style="color:var(--accent)">This collection is bigger than Orbit has read so far</b>; the rest arrive as the library is read.'}
<button class="btn gold" data-caddall="1" style="margin-top:8px">Add all ${c.offered.length}</button></div>`:''}
<div class="label">Or by type, genre, network and age</div>
(offered.length?`<div class="small" style="margin:6px 0 4px">${c.mode==='browse'?'Matching titles in your library, newest first.':'The Director suggests these from what you described and the shows you chose.'} Tap to add.</div>`:'');
body=`<div class="title" style="margin-top:14px">How it plays</div><div class="small">It shapes what's planned from then on, never what's already booked.</div><div style="margin-top:12px">`+
// Shaped: the Director's layout, to change. Tap a show to move it to the next slot; the star marks a core show.
if(d.style==='Shaped'){
constsh=c.shape;
// A film channel's stars are yours: the Director only suggests (Paul, 7 November 2026).
if(sh?.suggestedCore?.length&&!d.core.length)body+=`<div class="card small" style="margin-top:12px">The Director would star ${sh.suggestedCore.map(id=>esc(d.shows.find(x=>x.id===id)?.title||'')).join(', ')} to come round more often.
if(sh&&!Object.keys(d.slots).length)body+=`<div class="label">The Director's layout</div><div class="card small">Your picks are all one kind, so they play all day rather than being split into daytime, evening and late. ★ Core shows still come round more often.</div>
<button class="grow" data-cslot="${esc(x.id)}" style="text-align:left"><div style="font-weight:700">${esc(x.title)}</div><div class="small">Tap to move to ${SLOTS[(SLOTS.findIndex(s=>s[0]===slot)+1)%3][0]}</div></button></div>`).join('')
:'<div class="small" style="margin-top:6px">Nothing here: these hours share all your shows.</div>'}</div>`;}).join('')+
(sh.notes?.length?`<div class="small" style="margin-bottom:6px">To balance the day: ${sh.notes.map(esc).join(' ')}</div>`:'')+
'<div class="small">★ Core shows come round more often. Everything can be changed later.</div>';
<div style="display:flex;justify-content:space-between"><b style="font-size:17px">Let the Director build it</b><span class="small" style="color:var(--accent);font-weight:800">QUICK</span></div>
<div class="small" style="margin:6px 0 10px">Say what you fancy. It finds the shows in your library, lays out the day, and you check it.</div>
<input id="kdesc" value="${esc(d.description)}" placeholder="90s supernatural and sci-fi mysteries" style="width:100%;padding:13px;border-radius:12px;border:0;background:var(--deep);color:var(--ink);font:inherit">
<div style="display:flex;justify-content:space-between"><b style="font-size:17px">Build it yourself</b><span class="small" style="font-weight:800">CUSTOM</span></div>
<div class="small" style="margin-top:6px">Pick every show: search titles, open a collection, or a network. The Director still helps with the day.</div></div>`+note+
cBar(c.busy?'Looking…':'Build it for me','data-kquick="1"','Myself','data-kcustom="1"');
consthead=c.quick?`<div class="card" style="background:var(--raised);border-radius:14px"><b>“${esc(d.description)}”</b><div class="small" style="margin-top:4px">Untick any you don't want. Add your own with the search.</div></div>`:'';
returncTop(c.quick?`The Director picked ${d.shows.length}`:'Pick the shows')+head+searchBox(c.quick?'Add a show: search your library':'Search titles, collections, networks, genres')+
note+searchResults()+picked+cBar('Next: shape the day',`data-knext="shape" ${d.shows.length?'':'disabled style="flex:1;opacity:.5"'}`,null,null,chosenNote());
<div class="small" style="color:${k.complete?'var(--mint)':'var(--accent)'};font-weight:700">${k.complete?'Read in full from your library':'Still being read: more will appear'}</div>
<div class="small">${(k.found||0).toLocaleString()} in your library copy</div></div>
${items.length>(k.shown||60)?`<button class="btn" data-kmore="1" style="margin:6px 0 10px">Show ${Math.min(60,items.length-(k.shown||60))} more of ${items.length}</button>`:''}`+
cBar('Done with this collection','data-kcoldone="1"',null,null,`${chosenHere} of these chosen · ${chosenNote()}`);
}
if(c.view==='shape')returncTop('Shape the day')+shapeView()+note+cBar('Next: when it’s on','data-knext="when"',null,null,d.style==='Shaped'?'★ comes round more often':'');
if(d.style!=='Shaped')return`<div class="card small">${esc(STYLES.find(s=>s[0]===d.style)[1])}: ${esc(STYLES.find(s=>s[0]===d.style)[2])}. Change the style on Review.</div>`;
if(!sh)return'<div class="empty">The Director is laying out the day…</div>';
leth='';
if(sh.suggestedCore?.length&&!d.core.length&&!c.coreSet)h+=`<div class="card small">The Director would star ${sh.suggestedCore.map(id=>esc(d.shows.find(x=>x.id===id)?.title||'')).join(', ')} to come round more often.
if(!Object.keys(d.slots).length)returnh+`<div class="card small">Your picks are all one kind, so they play all day rather than being split into daytime, evening and late.</div>`+
h+=`<div class="card small" style="background:var(--deep)">The Director balanced this for you. Open a part of the day to star a show or move it.${sh.notes?.length?' '+esc(sh.notes.slice(0,2).join(' ')):''}</div>`;
h+=`<div class="card small" style="background:var(--deep)">Nothing changes on ${esc(room())} until you say. <b>Create channel</b> saves it and starts planning. <b>Create & watch next</b> switches to it after the programme on now.</div>`;
returnh+`<div class="kbar"><div class="kbarin"><button class="btn gold" data-kmake="next">${c.busy?'Saving…':d.number?'Save & watch next on '+esc(room()):'Create & watch next on '+esc(room())}</button>
// Who's watching (phase 3): Kids goes straight in; Adult asks for the PIN on the phone when one's set, as the TV does.
asyncfunctionswitchTo(id,pin){
buzz();
@@ -374,7 +465,47 @@ function seasonPicker() {
${w?`<div class="row" style="gap:6px;flex-wrap:wrap;justify-content:flex-start;margin:6px 0">From ${sel('fromDay',31,w.fromDay)}${sel('fromMonth',12,w.fromMonth)} to ${sel('toDay',31,w.toDay)}${sel('toMonth',12,w.toMonth)}</div>`:''}
${sug&&!w?`<div class="card small" style="margin-top:8px">The Director suggests ${esc(sug.label)}, as most of these are Christmas titles.<button class="btn" data-cseasonsug="1" style="margin-top:8px">Use ${esc(sug.label)}</button></div>`:''}`;
if(!picks.length){c.note='Nothing in your library fits that yet. Try other words, a collection or a network, or build it yourself.';c.busy=false;render();return;}
@@ -430,13 +561,16 @@ async function watchNew(when) {
}
c.trying=false;if(c.watching==='Planning its first programmes…')c.watching="It's still planning. Try again in a minute, or find it in the Guide.";render();
}catch(e){if(!offline)toast(e.message==='Failed to fetch'?"Orbit isn't open on the TV":e.message);offline=true;}
@@ -503,12 +638,20 @@ async function load(what) {
letoffline=false;
constsend=(path,body,done)=>{buzz();api(path,body).then(j=>{done?.(j);setTimeout(()=>load('now'),600);}).catch(e=>toast(e.message==='Failed to fetch'?"Orbit isn't open on the TV":e.message));};
if(d.klook){openSheet(`<div class="title">Look</div><div class="small" style="margin:6px 0 12px">Following the TV, each room's remote wears that room's look. Pick one to keep it on this phone instead.</div>
<div class="chips" style="flex-wrap:wrap"><button class="${keptLook()?'':'on'}" data-look="">Follow this TV${state.now?.look?' ('+esc(state.now.look.name)+')':''}</button>
if(d.kabout){openSheet(`<div class="title">Orbit Companion</div><div class="small" style="margin-top:8px">It runs on the TV itself, over your home Wi-Fi: nothing to install, no account. It works while Orbit is open on the TV. To stop this phone, remove it in Settings › Rooms and phones on the TV.</div>`);return;}
readableDatabase.rawQuery("SELECT id, runtime_ms FROM items WHERE runtime_ms IS NOT NULL AND id IN (${chunk.joinToString(",") { "?" }})",chunk.toTypedArray()).use{c->
valc=runBlocking{h.maker.collections()}.firstOrNull{it.name==r.query["collection"]}?:returnjson(out,404,JSONObject().put("error","That collection isn't in the library copy yet."))
assertFalse(shape.isNull("week"))// two shows: it says so
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.