' + esc(b.event || b.kind) + ' · ' + hm(b.startMs) + '–' + hm(b.endMs) +
diff --git a/android/app/src/main/java/tv/orbit/classic/EmbyConnectionScreen.kt b/android/app/src/main/java/tv/orbit/classic/EmbyConnectionScreen.kt
index fbf41d8b..56e3b795 100644
--- a/android/app/src/main/java/tv/orbit/classic/EmbyConnectionScreen.kt
+++ b/android/app/src/main/java/tv/orbit/classic/EmbyConnectionScreen.kt
@@ -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
diff --git a/android/app/src/main/java/tv/orbit/classic/EmbyPlaybackProtocol.kt b/android/app/src/main/java/tv/orbit/classic/EmbyPlaybackProtocol.kt
index 06734805..d5bef77c 100644
--- a/android/app/src/main/java/tv/orbit/classic/EmbyPlaybackProtocol.kt
+++ b/android/app/src/main/java/tv/orbit/classic/EmbyPlaybackProtocol.kt
@@ -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
): Map {
+ 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): List {
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, 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
diff --git a/android/app/src/main/java/tv/orbit/classic/OrbitCompanion.kt b/android/app/src/main/java/tv/orbit/classic/OrbitCompanion.kt
index f4fa0a5c..45f7e9f2 100644
--- a/android/app/src/main/java/tv/orbit/classic/OrbitCompanion.kt
+++ b/android/app/src/main/java/tv/orbit/classic/OrbitCompanion.kt
@@ -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 = { 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) -> Map = { 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()
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(256, .75f, true) { override fun removeEldestEntry(e: MutableMap.MutableEntry?) = size > 600 }
+ @Synchronized fun get(session: EmbySampleSession?, ids: List): Map {
+ 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()
+ }
+}
diff --git a/android/app/src/test/java/tv/orbit/classic/TimesBlurbTest.kt b/android/app/src/test/java/tv/orbit/classic/TimesBlurbTest.kt
new file mode 100644
index 00000000..2d514833
--- /dev/null
+++ b/android/app/src/test/java/tv/orbit/classic/TimesBlurbTest.kt
@@ -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"))
+ }
+}
diff --git a/design/times/masthead-preview.png b/design/times/masthead-preview.png
index aa307688..e689867b 100644
Binary files a/design/times/masthead-preview.png and b/design/times/masthead-preview.png differ
diff --git a/design/times/masthead.svg b/design/times/masthead.svg
index 1f3e0c9a..1a09c4e6 100644
--- a/design/times/masthead.svg
+++ b/design/times/masthead.svg
@@ -7,8 +7,8 @@
- ORBIT
- TV Times
+ ORBIT
+ TV Times
THE WEEK'S PROGRAMMES · EVERY CHANNEL
FREE WITH YOUR ORBIT
PICKS · FILMS · DRIVE-IN