From 1bc38e7c868db49b761e70d96d86a2d9f15e896a Mon Sep 17 00:00:00 2001 From: Pauljd Date: Sat, 7 Nov 2026 13:03:18 +0000 Subject: [PATCH] Create: save big collections, say the 200-title limit, more room between boxes Crunchyroll's 1,567 titles made the save too big for the TV to take in, so Sakura was refused. The phone now sends only what the TV keeps, stops at 200 titles and says so, and stacked boxes on Create and other screens have room between them. 0.108.88. Co-Authored-By: Claude Opus 5.5 (1M context) --- android/app/build.gradle.kts | 4 +-- .../app/src/main/assets/phone/companion.html | 32 +++++++++++++------ .../main/java/tv/orbit/classic/EmbyClient.kt | 4 +-- .../tv/orbit/classic/SecureMediaDataSource.kt | 2 +- 4 files changed, 28 insertions(+), 14 deletions(-) diff --git a/android/app/build.gradle.kts b/android/app/build.gradle.kts index b5c2ab0d..a9b2fe99 100644 --- a/android/app/build.gradle.kts +++ b/android/app/build.gradle.kts @@ -9,8 +9,8 @@ android { applicationId = "tv.orbit.classic" minSdk = 26 targetSdk = 36 - versionCode = 247 - versionName = "0.108.87-mistletoe-sakura" + versionCode = 248 + versionName = "0.108.88-big-collections" } buildFeatures { compose = true } // The finished build for the TVs (Paul, 6 November 2026: the test build stuttered on the box). Not debuggable, so diff --git a/android/app/src/main/assets/phone/companion.html b/android/app/src/main/assets/phone/companion.html index 4725a7bd..d8c5aec9 100644 --- a/android/app/src/main/assets/phone/companion.html +++ b/android/app/src/main/assets/phone/companion.html @@ -73,6 +73,12 @@ nav button.on{color:var(--accent);font-weight:700}nav button.on i{background:var .kbar{position:fixed;left:0;right:0;bottom:calc(64px + env(safe-area-inset-bottom));z-index:3;background:var(--deep);border-top:1px solid var(--surface);padding:10px 16px} .kbarin{max-width:460px;margin:0 auto} main.kpad{padding-bottom:230px} +/* Room between stacked boxes (Paul, 7 November 2026: "boxes close together"). */ +main .card+.card,main .card+.ch,main .ch+.card,main .card+.label{margin-top:12px} +main.kpad .ch{margin-bottom:10px;padding:13px 16px} +main.kpad .ch .then{white-space:normal} +/* Above Create's action bar, never over its button. */ +body:has(main.kpad) .toast{bottom:calc(250px + env(safe-area-inset-bottom))} .toast{position:fixed;left:50%;bottom:90px;transform:translateX(-50%);background:var(--accent);color:var(--on-accent);padding:9px 16px;border-radius:999px;font-weight:700;font-size:13px;z-index:9;display:none;max-width:90vw;text-align:center} .empty{color:var(--muted);text-align:center;padding:30px 10px} @@ -268,6 +274,9 @@ const STEPS = ['Shows','Shape','When','Review']; const VIEWS = {shows: 0, collection: 0, shape: 1, when: 2, review: 3}; const SLOTS = [['Daytime','06:00 to 17:00'],['Evening','17:00 to 22:00'],['Late','22:00 to 06:00']]; const WEEK_HOURS = {Daytime: 77, Evening: 35, Late: 56}; +// A channel carries up to 200 titles, as the TV keeps them; past that the phone says so rather than dropping them quietly. +const CHANNEL_MAX = 200; +const titles = n => `${n.toLocaleString()} title${n === 1 ? '' : 's'}`; const sameHours = (a, b) => JSON.stringify(a ?? null) === JSON.stringify(b ?? null); const room = () => state.now?.room || 'the TV'; const backArrow = ''; @@ -289,7 +298,7 @@ function rowTitle(x, on, sub) { return ``; } -const chosenNote = () => { const n = state.create.draft.shows.length; return n ? `${n} chosen · see them` : 'Nothing chosen yet'; }; +const chosenNote = () => { const n = state.create.draft.shows.length; return n ? `${n} chosen${n >= CHANNEL_MAX ? ', the most a channel carries' : ''} · see them` : 'Nothing chosen yet'; }; function searchBox(placeholder) { const c = state.create; return `
`
${s}
`; let h = ''; if (r.collections.length) h += label('Collections') + r.collections.map(k => ``).join(''); - if (r.networks.length) h += label('Networks and studios') + r.networks.map(k => ``).join(''); +
${titles(k.count)}${k.complete ? '' : ' · still being read'}
${fold(false).replace('M6 9l6 6 6-6', 'M9 6l6 6-6 6')}`).join(''); + if (r.networks.length) h += label('Networks and studios') + r.networks.map(k => ``).join(''); if (r.genres.length) h += label('Genres') + `
${r.genres.map(g => ``).join('')}
`; if (r.titles.length) h += label('Titles') + r.titles.map(x => rowTitle(x, d.shows.some(y => y.id === x.id))).join(''); if (!h) h = '
Nothing in your library matches that. Try a show, a collection like Crunchyroll, a network or a genre.
'; @@ -346,7 +355,7 @@ function create() {
Age
${chip('band', '', 'Any')}${chip('band', 'Kids', 'Kids')}${chip('band', 'Family', 'Family')}${chip('band', 'Teen', 'Teen')}${chip('band', 'Adult', 'Grown-up')}${chip('band', 'Unknown', 'Unrated')}
` : ''} ${note}${items.slice(0, k.shown || 60).map(x => rowTitle(x, d.shows.some(y => y.id === x.id))).join('')} ${items.length > (k.shown || 60) ? `` : ''}` + - cBar('Done with this collection', 'data-kcoldone="1"', null, null, `${chosenHere} of these chosen · ${chosenNote()}`); + cBar('Done with this collection', 'data-kcoldone="1"', null, null, `${chosenHere} from here · ${chosenNote()}`); } if (c.view === 'shape') return cTop('Shape the day') + shapeView() + note + cBar('Next: when it’s on', 'data-knext="when"', null, null, d.style === 'Shaped' ? '★ comes round more often' : ''); if (c.view === 'when') { @@ -375,7 +384,7 @@ function shapeView() { h += `
+ ${titles(mine.length)}${hrs ? ' · ' + hrs + ' h' : ''}
${open ? (mine.length ? mine.map(x => `
${esc(x.title)}
@@ -500,10 +509,11 @@ async function quickBuild() { try { const col = (state.collections || []).find(k => k.name.toLowerCase() === d.description.toLowerCase()); let picks; - if (col) { const r = await api('/api/browse?collection=' + encodeURIComponent(col.name)); picks = r.items.slice(0, 200); c.suggestedName = col.name; } + if (col) { const r = await api('/api/browse?collection=' + encodeURIComponent(col.name)); picks = r.items.slice(0, CHANNEL_MAX); c.suggestedName = col.name; + if (r.items.length > CHANNEL_MAX) c.capNote = `${col.name} has ${titles(r.found)}. A channel carries up to ${CHANNEL_MAX}, so the Director took the first ${CHANNEL_MAX}. Untick any, or build it yourself to choose.`; } else { picks = await api('/api/suggest?d=' + encodeURIComponent(d.description) + '&chosen=&skipped='); c.suggestedName = suggestName(d.description); } 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; } - d.shows = picks; c.quick = true; c.results = null; c.busy = false; goTo('shows'); + d.shows = picks; c.quick = true; c.results = null; c.busy = false; goTo('shows'); if (c.capNote) { c.note = c.capNote; c.capNote = ''; render(); } } catch (e) { c.note = e.message; c.busy = false; render(); } } function chosenSheet() { @@ -570,7 +580,7 @@ async function makeChannel(ending) { const c = state.create, d = c.draft; if (c.busy) return; d.name = ($('#kname')?.value || d.name || '').trim(); if (!d.name) { toast('Give it a name first'); return; } c.busy = true; render(); - try { const r = await api('/api/channels', {number: d.number, name: d.name, description: d.description, style: d.style, hours: d.hours, shows: d.shows, + try { const r = await api('/api/channels', {number: d.number, name: d.name, description: d.description, style: d.style, hours: d.hours, shows: d.shows.map(x => ({id: x.id, title: x.title, year: x.year ?? null, type: x.type})), slots: d.style === 'Shaped' ? d.slots : undefined, core: d.style === 'Shaped' ? d.core : undefined, season: d.season || null, brand: d.brand !== undefined ? d.brand : undefined}); c.done = {number: r.number, name: d.name, message: r.message, edit: !!d.number}; c.busy = false; render(); load('more'); @@ -688,6 +698,7 @@ document.addEventListener('click', e => { if (d.ksearch) { runSearch(); return; } if (d.ktoggle) { const dr = state.create.draft, id = d.ktoggle, c = state.create; if (dr.shows.some(x => x.id === id)) dr.shows = dr.shows.filter(x => x.id !== id); + else if (dr.shows.length >= CHANNEL_MAX) toast(`A channel carries up to ${CHANNEL_MAX} titles`); else { const x = [...(c.results?.titles || []), ...(c.col?.items || [])].find(x => x.id === id); if (x) dr.shows.push(x); } render(); return; } if (d.kcol) { openCollection(d.kcol); return; } @@ -697,7 +708,10 @@ document.addEventListener('click', e => { api('/api/browse?genre=' + encodeURIComponent(d.kgenre)).then(items => { c.results = {collections: [], networks: [], genres: [], titles: items}; c.query = d.kgenre; }).catch(e => c.note = e.message).finally(() => { c.busy = false; render(); }); return; } if (d.kaddall) { const c = state.create, rf = c.col.refine; const items = c.col.items.filter(x => (!rf.type || x.type === rf.type) && (!rf.band || x.band === rf.band)); - items.forEach(x => { if (!c.draft.shows.some(y => y.id === x.id)) c.draft.shows.push(x); }); toast(`Added ${items.length}`); render(); return; } + const fresh = items.filter(x => !c.draft.shows.some(y => y.id === x.id)), room = Math.max(0, CHANNEL_MAX - c.draft.shows.length); + fresh.slice(0, room).forEach(x => c.draft.shows.push(x)); + c.note = fresh.length > room ? `A channel carries up to ${CHANNEL_MAX} titles, so ${room ? `the first ${room} of these ${fresh.length.toLocaleString()} were added` : 'none more could be added'}. Refine to Shows, Films or an age to choose a different ${CHANNEL_MAX}.` : ''; + toast(`Added ${Math.min(room, fresh.length)}`); render(); return; } if (d.krefine) { state.create.col.refineOpen = !state.create.col.refineOpen; render(); return; } if (d.kref) { const cut = d.kref.indexOf(':'), k = d.kref.slice(0, cut), v = d.kref.slice(cut + 1); state.create.col.refine[k] = v; render(); return; } if (d.kmore) { state.create.col.shown = (state.create.col.shown || 60) + 60; render(); return; } diff --git a/android/app/src/main/java/tv/orbit/classic/EmbyClient.kt b/android/app/src/main/java/tv/orbit/classic/EmbyClient.kt index 03623a43..fd6de87f 100644 --- a/android/app/src/main/java/tv/orbit/classic/EmbyClient.kt +++ b/android/app/src/main/java/tv/orbit/classic/EmbyClient.kt @@ -62,9 +62,9 @@ internal class HttpsEmbyTransport(internal val deviceId: String = UUID.randomUUI } /** The sign-in headers for this kind of server. */ internal fun authHeaders(token: String?): Map = when (kind) { - ServerKind.Emby -> mapOf("X-Emby-Authorization" to "Emby Client=\"Orbit TV\", Device=\"Orbit TV\", DeviceId=\"$deviceId\", Version=\"0.108.87\"") + + ServerKind.Emby -> mapOf("X-Emby-Authorization" to "Emby Client=\"Orbit TV\", Device=\"Orbit TV\", DeviceId=\"$deviceId\", Version=\"0.108.88\"") + (token?.let { mapOf("X-Emby-Token" to it) } ?: emptyMap()) - ServerKind.Jellyfin -> mapOf("Authorization" to "MediaBrowser Client=\"Orbit TV\", Device=\"Orbit TV\", DeviceId=\"$deviceId\", Version=\"0.108.87\"" + + ServerKind.Jellyfin -> mapOf("Authorization" to "MediaBrowser Client=\"Orbit TV\", Device=\"Orbit TV\", DeviceId=\"$deviceId\", Version=\"0.108.88\"" + (token?.let { ", Token=\"$it\"" } ?: "")) } /** One picture from the provider, or nothing. Same fixed origin and no redirects, and failures are never shown or logged. */ diff --git a/android/app/src/main/java/tv/orbit/classic/SecureMediaDataSource.kt b/android/app/src/main/java/tv/orbit/classic/SecureMediaDataSource.kt index 3b5491d0..f660e258 100644 --- a/android/app/src/main/java/tv/orbit/classic/SecureMediaDataSource.kt +++ b/android/app/src/main/java/tv/orbit/classic/SecureMediaDataSource.kt @@ -39,7 +39,7 @@ internal class SecureMediaDataSource(private val session: EmbySampleSession) : B next.instanceFollowRedirects = false next.connectTimeout = 10_000 next.readTimeout = 20_000 - next.setRequestProperty("User-Agent", "OrbitTV/0.108.87") + next.setRequestProperty("User-Agent", "OrbitTV/0.108.88") next.setRequestProperty("Accept-Encoding", "identity") session.mediaHeaders(address).forEach { (key, value) -> next.setRequestProperty(key, value) } if (dataSpec.position != 0L || dataSpec.length != C.LENGTH_UNSET.toLong()) {