Orbit TV Times: library descriptions, more room, masthead fits phones (0.110.3)

Paul, 8 November 2026: the stock reasons ('An evening film on a film channel') are replaced by each programme's own
words from the library: a short tagline, else the synopsis's first sentence, with a film's two leads (one request
per edition for new items, cached). Each listing is its own card with more space; the masthead's titles have a fixed
width so a phone's serif can't push 'TV Times' off the edge.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-08 13:43:41 +00:00
co-authored by Claude Opus 5.5
parent a904f5c60d
commit a151db4d64
10 changed files with 97 additions and 18 deletions
+2 -2
View File
@@ -9,8 +9,8 @@ android {
applicationId = "tv.orbit.classic"
minSdk = 26
targetSdk = 36
versionCode = 277
versionName = "0.110.2-phone-remembered"
versionCode = 278
versionName = "0.110.3-times-refined"
}
buildFeatures { compose = true }
// The finished build for the TVs (Paul, 6 November 2026: the test build stuttered on the box). Not debuggable, so
+12 -8
View File
@@ -15,15 +15,16 @@ body{margin:0;background:var(--paper);color:var(--ink);font-family:Georgia,'Time
main{max-width:980px;margin:0 auto;padding:12px 14px 40px}
.day h2{font-size:30px;margin:14px 0 4px;border-bottom:3px solid var(--red);padding-bottom:4px}
.day h2 small{font:600 14px system-ui,sans-serif;color:var(--muted);margin-left:8px}
.pick{display:grid;grid-template-columns:auto 1fr;gap:12px;background:var(--navy);color:#fff;border-radius:6px;padding:14px;margin:12px 0}
.pick{display:grid;grid-template-columns:auto 1fr;gap:12px;line-height:1.45;background:var(--navy);color:#fff;border-radius:6px;padding:14px;margin:12px 0}
.pick .badge{background:var(--gold);color:var(--navy);font:900 13px/1 system-ui,sans-serif;padding:8px 10px;border-radius:4px;align-self:start;letter-spacing:1px}
.pick h3{margin:0;font-size:24px;color:var(--gold)}
.pick p{margin:4px 0 0}
.sec{font:900 14px system-ui,sans-serif;letter-spacing:2px;color:var(--red);margin:18px 0 6px;text-transform:uppercase}
.cols{columns:2 300px;column-gap:24px;column-rule:1px solid var(--rule)}
.row{break-inside:avoid;padding:6px 0;border-bottom:1px dotted var(--rule)}
.cols{columns:2 320px;column-gap:20px}
.row{break-inside:avoid;background:#fff;border:1px solid var(--rule);border-left:4px solid var(--red);border-radius:6px;padding:10px 12px;margin:0 0 10px}
.blurb{margin:5px 0 4px;font-size:15px;line-height:1.4}
.t{font:700 15px system-ui,sans-serif;color:var(--red);margin-right:6px}
.title{font-weight:700;font-size:17px}
.title{font-weight:700;font-size:18px;line-height:1.25}
.sub{font-style:italic;color:var(--muted)}
.meta{font:600 12px system-ui,sans-serif;color:var(--muted)}
.tag{display:inline-block;font:800 10px system-ui,sans-serif;letter-spacing:1px;background:var(--gold);color:var(--navy);padding:2px 5px;border-radius:3px;margin-left:4px;vertical-align:2px}
@@ -41,7 +42,7 @@ footer{font:12px system-ui,sans-serif;color:var(--muted);text-align:center;margi
}
</style></head>
<body>
<div class="mast"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 260" width="1200" height="260"> <rect width="1200" height="260" fill="#c8102e"/> <rect x="0" y="214" width="1200" height="46" fill="#0b1630"/> <g transform="translate(70 40)"> <circle cx="70" cy="70" r="66" fill="none" stroke="#ffc72c" stroke-width="10"/> <ellipse cx="70" cy="70" rx="104" ry="30" fill="none" stroke="#ffc72c" stroke-width="8" transform="rotate(-18 70 70)"/> <circle cx="70" cy="70" r="34" fill="#ffc72c"/> </g> <text x="250" y="150" font-family="Georgia, 'Times New Roman', serif" font-weight="700" font-size="136" fill="#ffffff" letter-spacing="2">ORBIT</text> <text x="742" y="150" font-family="Georgia, 'Times New Roman', serif" font-style="italic" font-weight="700" font-size="104" fill="#ffc72c">TV Times</text> <text x="252" y="196" font-family="Arial, Helvetica, sans-serif" font-weight="700" font-size="28" fill="#ffffff" letter-spacing="6">THE WEEK'S PROGRAMMES · EVERY CHANNEL</text> <text x="70" y="246" font-family="Arial, Helvetica, sans-serif" font-weight="700" font-size="24" fill="#ffc72c" letter-spacing="4">FREE WITH YOUR ORBIT</text> <text x="1130" y="246" text-anchor="end" font-family="Arial, Helvetica, sans-serif" font-weight="700" font-size="24" fill="#ffffff" letter-spacing="4">PICKS · FILMS · DRIVE-IN</text> </svg> </div>
<div class="mast"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 260" width="1200" height="260"> <rect width="1200" height="260" fill="#c8102e"/> <rect x="0" y="214" width="1200" height="46" fill="#0b1630"/> <g transform="translate(70 40)"> <circle cx="70" cy="70" r="66" fill="none" stroke="#ffc72c" stroke-width="10"/> <ellipse cx="70" cy="70" rx="104" ry="30" fill="none" stroke="#ffc72c" stroke-width="8" transform="rotate(-18 70 70)"/> <circle cx="70" cy="70" r="34" fill="#ffc72c"/> </g> <text x="250" y="150" font-family="Georgia, 'Times New Roman', serif" font-weight="700" font-size="136" fill="#ffffff" textLength="440" lengthAdjust="spacingAndGlyphs">ORBIT</text> <text x="720" y="150" font-family="Georgia, 'Times New Roman', serif" font-style="italic" font-weight="700" font-size="104" fill="#ffc72c" textLength="430" lengthAdjust="spacingAndGlyphs">TV Times</text> <text x="252" y="196" font-family="Arial, Helvetica, sans-serif" font-weight="700" font-size="28" fill="#ffffff" letter-spacing="6">THE WEEK'S PROGRAMMES · EVERY CHANNEL</text> <text x="70" y="246" font-family="Arial, Helvetica, sans-serif" font-weight="700" font-size="24" fill="#ffc72c" letter-spacing="4">FREE WITH YOUR ORBIT</text> <text x="1130" y="246" text-anchor="end" font-family="Arial, Helvetica, sans-serif" font-weight="700" font-size="24" fill="#ffffff" letter-spacing="4">PICKS · FILMS · DRIVE-IN</text> </svg></div>
<div class="bar"><a href="/">‹ Back to Orbit</a><span id="issue"></span><button id="print">Print or save PDF</button></div>
<div class="days" id="days"></div>
<main id="main"><div class="empty">Loading this week's listings…</div></main>
@@ -52,13 +53,16 @@ const hm = ms => new Date(ms).toLocaleTimeString('en-GB', {hour: '2-digit', minu
const dayName = iso => new Date(iso + 'T12:00:00').toLocaleDateString('en-GB', {weekday: 'long', day: 'numeric', month: 'long'});
let data = null, shown = 0;
function row(i) {
return '<div class="row"><span class="t">' + hm(i.startMs) + '</span><span class="title">' + esc(i.title) + '</span>' + (i.tag ? '<span class="tag">' + esc(i.tag).toUpperCase() + '</span>' : '') +
(i.sub ? '<div class="sub">' + esc(i.sub) + '</div>' : '') + '<div class="meta">' + i.channel + ' ' + esc(i.name) + ' · until ' + hm(i.endMs) + (i.reason ? ' · ' + esc(i.reason) : '') + '</div></div>';
// Programme first, then the library's own words for it, then where and when (Paul, 8 November 2026: more editorial, more room).
return '<div class="row"><div><span class="t">' + hm(i.startMs) + '</span>' + (i.tag ? '<span class="tag">' + esc(i.tag).toUpperCase() + '</span>' : '') + '</div>' +
'<div class="title">' + esc(i.title) + '</div>' + (i.sub ? '<div class="sub">' + esc(i.sub) + '</div>' : '') +
(i.blurb ? '<p class="blurb">' + esc(i.blurb) + '</p>' : '') +
'<div class="meta">' + i.channel + ' ' + esc(i.name) + ' · until ' + hm(i.endMs) + '</div></div>';
}
function day(d) {
let h = '<section class="day" data-day="' + esc(d.date) + '"><h2>' + esc(dayName(d.date)) + '</h2>';
if (d.pick) h += '<div class="pick"><div class="badge">PICK OF<br>THE DAY</div><div><h3>' + esc(d.pick.title) + '</h3><p>' + (d.pick.sub ? '<i>' + esc(d.pick.sub) + '</i><br>' : '') +
hm(d.pick.startMs) + ' on ' + d.pick.channel + ' ' + esc(d.pick.name) + (d.pick.reason ? ' · ' + esc(d.pick.reason) : '') + '</p></div></div>';
(d.pick.blurb ? esc(d.pick.blurb) + '<br>' : '') + '<b>' + hm(d.pick.startMs) + ' on ' + d.pick.channel + ' ' + esc(d.pick.name) + '</b>' + '</p></div></div>';
if (d.highlights.length) h += '<div class="sec">Tonight\'s highlights</div><div class="cols">' + d.highlights.map(row).join('') + '</div>';
if (d.films.length) h += '<div class="sec">Films this evening</div><div class="cols">' + d.films.map(row).join('') + '</div>';
if (d.drivein.length) h += '<div class="sec">At the Drive-In</div>' + d.drivein.map(b => '<div class="drive"><b>' + esc(b.event || b.kind) + '</b> · ' + hm(b.startMs) + '–' + hm(b.endMs) +
@@ -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<String, String> = when (kind) {
ServerKind.Emby -> mapOf("X-Emby-Authorization" to "Emby Client=\"Orbit TV\", Device=\"Orbit TV\", DeviceId=\"$deviceId\", Version=\"0.110.2\"") +
ServerKind.Emby -> mapOf("X-Emby-Authorization" to "Emby Client=\"Orbit TV\", Device=\"Orbit TV\", DeviceId=\"$deviceId\", Version=\"0.110.3\"") +
(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.110.2\"" +
ServerKind.Jellyfin -> mapOf("Authorization" to "MediaBrowser Client=\"Orbit TV\", Device=\"Orbit TV\", DeviceId=\"$deviceId\", Version=\"0.110.3\"" +
(token?.let { ", Token=\"$it\"" } ?: ""))
}
/** One picture from the provider, or nothing. Same fixed origin and no redirects, and failures are never shown or logged. */
@@ -748,7 +748,8 @@ internal fun EmbyConnectionScreen(modifier: Modifier = Modifier, visible: Boolea
decision == "deferred" -> "${idea.theme} deferred: it can come back in four weeks."
else -> "${idea.theme} dismissed: it won't be proposed again unless its films change." }
},
reminders = { companionReminders }, remind = { number, startMs, title, on -> companionRemind(number, startMs, title, on) })
reminders = { companionReminders }, remind = { number, startMs, title, on -> companionRemind(number, startMs, title, on) },
describe = { ids -> TimesBlurbs.get(session, ids) })
}
DisposableEffect(Unit) {
PhoneLink.screen = companionScreen
@@ -267,6 +267,22 @@ internal class EmbySampleSession(private val transport: EmbyTransport, private v
return films.associate { (film, person) -> film.itemId to checkEventFilm(film, byId[film.itemId], person, BoxDecoders::canDecode) }
}
/** Orbit TV Times' short descriptions for [ids], read only, in one request: see [timesBlurb]. */
fun readBlurbs(ids: List<String>): Map<String, String> {
val valid = ids.filter(EmbyClient::validId).distinct().take(60)
if (valid.isEmpty()) return emptyMap()
val reply = transport.execute(EmbyRequest("GET", "/Items?UserId=$userId&Ids=${valid.joinToString(",")}&Fields=Overview,Taglines,People" +
"&EnableImages=false&EnableUserData=false", token = currentToken(), readTimeoutMs = WHOLE_SERIES_TIMEOUT_MS))
EmbyClient.expectSuccess(reply.status, false)
val rows = EmbyClient.parse(reply.body).optJSONArray("Items")
return (0 until (rows?.length() ?: 0)).mapNotNull { rows!!.optJSONObject(it) }.mapNotNull { row ->
val id = row.optString("Id").takeIf(EmbyClient::validId) ?: return@mapNotNull null
val leads = row.optJSONArray("People")?.let { a -> (0 until a.length()).mapNotNull { a.optJSONObject(it) } }.orEmpty()
.filter { it.optString("Type") == "Actor" }.take(2).map { EmbyClient.clean(it.optString("Name"), 50) }.filter { it.isNotBlank() }
timesBlurb(row.optJSONArray("Taglines")?.optString(0), row.optString("Overview"), leads, row.optString("Type"))?.let { id to it }
}.toMap()
}
/** Stage D evidence for [ids], read only, in one request: see [evidenceLine]. */
fun readEvidence(ids: List<String>): List<JSONObject> {
val valid = ids.filter(EmbyClient::validId)
@@ -514,3 +530,22 @@ internal object EmbyCleanup {
private val executor = java.util.concurrent.Executors.newSingleThreadExecutor { task -> Thread(task, "Orbit-session-cleanup").apply { isDaemon = true } }
fun run(task: () -> Unit) { executor.execute { try { task() } catch (_: Exception) { } } }
}
/**
* A listings line for Orbit TV Times (Paul, 8 November 2026: "make the descriptions more editorial"), from the library's own
* words: the film's tagline when it has a short one, otherwise the first sentence of its synopsis, with its two leads for a
* film. Never longer than about two lines on a phone.
*/
internal fun timesBlurb(tagline: String?, overview: String?, leads: List<String>, type: String): String? {
fun tidy(s: String?) = s?.filter { !it.isISOControl() }?.replace(Regex("\\s+"), " ")?.trim().orEmpty()
val tag = tidy(tagline).takeIf { it.length in 8..TIMES_BLURB_MAX }
val first = tidy(overview).let { o -> Regex("^(.{20,}?[.!?])(\\s|$)").find(o)?.groupValues?.get(1) ?: o }.let { s ->
if (s.length <= TIMES_BLURB_MAX) s else s.take(TIMES_BLURB_MAX).substringBeforeLast(' ').trimEnd(',', ';', ':') + "…"
}.takeIf { it.isNotBlank() }
val line = tag ?: first ?: return leads.takeIf { type == "Movie" && it.isNotEmpty() }?.let { "Starring ${it.joinToString(" and ")}." }
val star = if (type == "Movie" && leads.isNotEmpty() && leads.none { line.contains(it) }) " With ${leads.joinToString(" and ")}." else ""
return line + star
}
internal const val TIMES_BLURB_MAX = 150
@@ -48,7 +48,9 @@ internal class CompanionScreen(
val decideIdea: (DeskEventIdea, String) -> String = { _, _ -> "" },
/** Programme reminders, the same ones the TV guide and What's On set (8 November 2026). */
val reminders: () -> List<ProgrammeReminder> = { emptyList() },
val remind: (number: Int, startMs: Long, title: String, on: Boolean) -> Unit = { _, _, _, _ -> })
val remind: (number: Int, startMs: Long, title: String, on: Boolean) -> Unit = { _, _, _, _ -> },
/** Short descriptions for Orbit TV Times, by item id, from the library (cached); empty when the library can't be reached. */
val describe: (List<String>) -> Map<String, String> = { emptyMap() })
/**
* Phase 2's queue (Paul, 6 November 2026): what plays when the programme on now ends. A channel, live from then ("switch
@@ -231,10 +233,11 @@ internal object OrbitCompanion {
val channels = screen.channels()
val plans = channels.mapNotNull { c -> (c as? ScheduledChannel)?.let { c.number to it.plan } }.toMap()
val names = channels.associate { it.number to ChannelBrands.displayName(it) }
val blurbs = HashMap<String, String>()
fun item(channel: Int, e: ScheduleEntry, tag: String?, reason: String?) = guideTitleParts(e.media.item.title).let { (title, sub) ->
JSONObject().put("channel", channel).put("name", names[channel] ?: channel.toString()).put("title", title).put("sub", sub ?: JSONObject.NULL)
.put("startMs", e.startMs).put("endMs", e.endMs).put("type", e.media.item.type)
.put("tag", tag ?: JSONObject.NULL).put("reason", reason ?: JSONObject.NULL)
.put("tag", tag ?: JSONObject.NULL).put("reason", reason ?: JSONObject.NULL).put("blurb", blurbs[e.media.item.id] ?: JSONObject.NULL)
}
val first = whatsOnEdition(nowMs, zone)
val days = JSONArray()
@@ -248,6 +251,8 @@ internal object OrbitCompanion {
.sortedBy { it.second.startMs }.distinctBy { it.second.media.item.id }.take(TIMES_FILMS)
val bills = screen.driveIn().filter { it.startMs in noon until end }
if (page.pick == null && page.tonight.isEmpty() && films.isEmpty() && bills.isEmpty()) continue
val wanted = (listOfNotNull(page.pick) + page.tonight).map { it.entry.media.item.id } + films.map { it.second.media.item.id }
wanted.filter { it !in blurbs }.takeIf { it.isNotEmpty() }?.let { ids -> runCatching { blurbs.putAll(screen.describe(ids)) } }
days.put(JSONObject().put("date", date.toString()).put("noonMs", noon)
.put("pick", page.pick?.let { item(it.channel, it.entry, it.tag, it.reason) } ?: JSONObject.NULL)
.put("highlights", JSONArray(page.tonight.map { item(it.channel, it.entry, it.tag, it.reason) }))
@@ -316,3 +321,13 @@ internal object OrbitCompanion {
}
@Synchronized fun stopLooking() { finder?.stop(); finder = null }
}
/** Orbit TV Times' descriptions, kept while Orbit is open so each edition asks the library only for what's new. */
internal object TimesBlurbs {
private val cache = object : LinkedHashMap<String, String>(256, .75f, true) { override fun removeEldestEntry(e: MutableMap.MutableEntry<String, String>?) = size > 600 }
@Synchronized fun get(session: EmbySampleSession?, ids: List<String>): Map<String, String> {
val missing = ids.filter { it !in cache }.distinct()
if (session != null && missing.isNotEmpty()) runCatching { missing.chunked(60).forEach { cache.putAll(session.readBlurbs(it)) } }
return ids.mapNotNull { id -> cache[id]?.let { id to it } }.toMap()
}
}
@@ -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.110.2")
next.setRequestProperty("User-Agent", "OrbitTV/0.110.3")
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()) {
@@ -0,0 +1,24 @@
package tv.orbit.classic
import org.junit.Assert.*
import org.junit.Test
/** 8 November 2026: Orbit TV Times describes programmes in the library's own words, briefly. */
class TimesBlurbTest {
@Test fun aShortTaglineWinsWithTheLeads() {
assertEquals("Long live the king. With Chadwick Boseman and Michael B. Jordan.",
timesBlurb("Long live the king.", "T'Challa returns home to Wakanda to take his rightful place as king. More text.", listOf("Chadwick Boseman", "Michael B. Jordan"), "Movie"))
}
@Test fun otherwiseTheSynopsisFirstSentence() {
assertEquals("Del and Rodney take on a job restoring a chandelier.",
timesBlurb(null, "Del and Rodney take on a job restoring a chandelier. It doesn't go well.", emptyList(), "Episode"))
}
@Test fun longTextIsCutAtAWord() {
val b = timesBlurb(null, "word ".repeat(80), emptyList(), "Episode")!!
assertTrue(b.length <= TIMES_BLURB_MAX + 1); assertTrue(b.endsWith("…"))
}
@Test fun nothingToSayStaysEmpty() {
assertNull(timesBlurb(null, "", emptyList(), "Episode"))
assertEquals("Starring Bill Murray.", timesBlurb("", null, listOf("Bill Murray"), "Movie"))
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 33 KiB

+2 -2
View File
@@ -7,8 +7,8 @@
<ellipse cx="70" cy="70" rx="104" ry="30" fill="none" stroke="#ffc72c" stroke-width="8" transform="rotate(-18 70 70)"/>
<circle cx="70" cy="70" r="34" fill="#ffc72c"/>
</g>
<text x="250" y="150" font-family="Georgia, 'Times New Roman', serif" font-weight="700" font-size="136" fill="#ffffff" letter-spacing="2">ORBIT</text>
<text x="742" y="150" font-family="Georgia, 'Times New Roman', serif" font-style="italic" font-weight="700" font-size="104" fill="#ffc72c">TV Times</text>
<text x="250" y="150" font-family="Georgia, 'Times New Roman', serif" font-weight="700" font-size="136" fill="#ffffff" textLength="440" lengthAdjust="spacingAndGlyphs">ORBIT</text>
<text x="720" y="150" font-family="Georgia, 'Times New Roman', serif" font-style="italic" font-weight="700" font-size="104" fill="#ffc72c" textLength="430" lengthAdjust="spacingAndGlyphs">TV Times</text>
<text x="252" y="196" font-family="Arial, Helvetica, sans-serif" font-weight="700" font-size="28" fill="#ffffff" letter-spacing="6">THE WEEK'S PROGRAMMES · EVERY CHANNEL</text>
<text x="70" y="246" font-family="Arial, Helvetica, sans-serif" font-weight="700" font-size="24" fill="#ffc72c" letter-spacing="4">FREE WITH YOUR ORBIT</text>
<text x="1130" y="246" text-anchor="end" font-family="Arial, Helvetica, sans-serif" font-weight="700" font-size="24" fill="#ffffff" letter-spacing="4">PICKS · FILMS · DRIVE-IN</text>

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB