Coming up next, phone reminders, Continue watching on Home, Orbit TV Times (0.110.0)
- Coming up next: a small corner card for ten seconds, three minutes before a programme ends, before the squeeze-back and ident; never names a grown-up takeover on Kids. Settings > Coming up next (on by default; travels with Look). - Reminders from the phone's guide: Remind me on the next programme, the same reminders the TV guide and What's On use; /api/remind only for a programme still to come on a channel this TV shows. - Home: a Continue watching list (three, words only) under the categories; OK carries on where it was left. - Orbit TV Times: /times on the phone, a listings magazine of the week from the real plans (pick of the day, the evening's highlights and films, the Drive-In), day by day, printable to A4; masthead in design/times (VectorCraft). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -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.108.109\"") +
|
||||
ServerKind.Emby -> mapOf("X-Emby-Authorization" to "Emby Client=\"Orbit TV\", Device=\"Orbit TV\", DeviceId=\"$deviceId\", Version=\"0.110.0\"") +
|
||||
(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.109\"" +
|
||||
ServerKind.Jellyfin -> mapOf("Authorization" to "MediaBrowser Client=\"Orbit TV\", Device=\"Orbit TV\", DeviceId=\"$deviceId\", Version=\"0.110.0\"" +
|
||||
(token?.let { ", Token=\"$it\"" } ?: ""))
|
||||
}
|
||||
/** One picture from the provider, or nothing. Same fixed origin and no redirects, and failures are never shown or logged. */
|
||||
|
||||
@@ -703,6 +703,12 @@ internal fun EmbyConnectionScreen(modifier: Modifier = Modifier, visible: Boolea
|
||||
if (offset == 0L) liveHandoff.handOver(number)
|
||||
channelClockOffset = offset; watchingChannel = true
|
||||
}
|
||||
/** Carries on a Continue watching programme from where it was left, from Catch Up or Home, while it's still in Catch Up. */
|
||||
fun resumeContinue(c: ContinueEntry) {
|
||||
if (c.entry.show.startMs < System.currentTimeMillis() - CATCH_UP_MS || lockedOut(c.entry.channel.number) || profileHides(c.entry.channel.number)) return
|
||||
tune(c.entry.channel.number, c.entry.show.startMs + c.positionMs - System.currentTimeMillis())
|
||||
Taste.record(TasteKind.Chose, c.entry.show.media.item.id, (c.entry.channel as? ScheduledChannel)?.seriesIdAt(c.entry.show.startMs), c.entry.show.media.item.title, c.entry.channel.number, "continue")
|
||||
}
|
||||
// Orbit Companion: the channels this TV shows right now, and tuning as the guide does. Set here, before any screen
|
||||
// returns early, so the phone works from every section (the Drive-In and the Arcade go to the guide to tune).
|
||||
val shownChannels by rememberUpdatedState(availableChannels.filter { !lockedOut(it.number) && !profileHides(it.number) })
|
||||
@@ -716,6 +722,11 @@ internal fun EmbyConnectionScreen(modifier: Modifier = Modifier, visible: Boolea
|
||||
val companionBills by rememberUpdatedState(driveInPlan.takeIf { Profiles.current?.let { it.kind != ProfileKind.Kids || it.driveIn } ?: true }
|
||||
?.let { plan -> driveInLineup(driveInBills(plan), System.currentTimeMillis()).filter { !lockedOut(it) } }.orEmpty())
|
||||
val companionDriveIn by rememberUpdatedState(mainDriveIn)
|
||||
val companionReminders by rememberUpdatedState(reminders)
|
||||
val companionRemind by rememberUpdatedState { number: Int, startMs: Long, title: String, on: Boolean ->
|
||||
val kept = liveReminders(reminders, System.currentTimeMillis()).filterNot { it.channel == number && it.startMs == startMs }
|
||||
saveReminders(if (on) kept + ProgrammeReminder(number, startMs, title) else kept)
|
||||
}
|
||||
val companionScreen = remember {
|
||||
CompanionScreen(channels = { shownChannels }, selected = { selectedNumber }, watching = { watchingChannel }, offset = { channelClockOffset },
|
||||
tune = { n, offset -> companionTune(n, offset) }, driveIn = { companionBills }, tickets = { companionTickets.keys },
|
||||
@@ -736,7 +747,8 @@ internal fun EmbyConnectionScreen(modifier: Modifier = Modifier, visible: Boolea
|
||||
decision == "approved" -> "${idea.theme} approved for ${idea.evening}. It books once the Drive-In plans that evening, after its films are checked again."
|
||||
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) })
|
||||
}
|
||||
DisposableEffect(Unit) {
|
||||
PhoneLink.screen = companionScreen
|
||||
@@ -796,12 +808,10 @@ internal fun EmbyConnectionScreen(modifier: Modifier = Modifier, visible: Boolea
|
||||
}
|
||||
val picture = @Composable { GuidePicture(liveSession, liveChannel, live = !watchingChannel, handoff = liveHandoff, onUnplayable = ::rememberUnplayable) }
|
||||
when {
|
||||
mainHome -> HomeScreen(availableChannels, modifier, onCategory = { guideCategory = it; onGuide() })
|
||||
mainHome -> HomeScreen(availableChannels, modifier, onCategory = { guideCategory = it; onGuide() },
|
||||
carryOn = continueEntries(availableChannels.filter { !lockedOut(it.number) && !profileHides(it.number) }, ContinueWatching.marks, System.currentTimeMillis()), onResume = ::resumeContinue)
|
||||
mainCatchUp -> CatchUpScreen(availableChannels, liveSession, modifier, onOpen = { catchUpOpen = it },
|
||||
onResume = { c -> if (c.entry.show.startMs >= System.currentTimeMillis() - CATCH_UP_MS) {
|
||||
tune(c.entry.channel.number, c.entry.show.startMs + c.positionMs - System.currentTimeMillis())
|
||||
Taste.record(TasteKind.Chose, c.entry.show.media.item.id, (c.entry.channel as? ScheduledChannel)?.seriesIdAt(c.entry.show.startMs), c.entry.show.media.item.title, c.entry.channel.number, "continue")
|
||||
} })
|
||||
onResume = ::resumeContinue)
|
||||
mainWhatsOn -> WhatsOnScreen(liveSession, scheduledChannels.filterKeys { !lockedOut(it) && !profileHides(it) }.mapValues { it.value.plan },
|
||||
driveInPlan.takeIf { Profiles.current?.let { it.kind != ProfileKind.Kids || it.driveIn } ?: true }, modifier, reminders,
|
||||
onWatch = { tune(it, 0) }, onDriveIn = onDriveIn, onBack = onHome,
|
||||
|
||||
@@ -32,6 +32,9 @@ internal enum class ChannelCategory(val label: String, val icon: Int) {
|
||||
}
|
||||
|
||||
/** All Channels, then only the categories that have a channel in them. */
|
||||
/** Continue watching rows on Home; the rest are in Catch Up. */
|
||||
internal const val HOME_CONTINUE_MAX = 3
|
||||
|
||||
internal fun homeCategories(numbers: List<Int>): List<ChannelCategory> {
|
||||
val used = numbers.mapNotNull { ChannelBrands.forNumber(it)?.category }.toSet()
|
||||
return ChannelCategory.entries.filter { it == ChannelCategory.All || it in used }
|
||||
@@ -68,7 +71,9 @@ internal fun HomeCard(modifier: Modifier = Modifier, focusRequester: FocusReques
|
||||
* Guide on that category. What's On holds the evening's highlights.
|
||||
*/
|
||||
@Composable
|
||||
internal fun HomeScreen(channels: List<SampleChannel>, modifier: Modifier = Modifier, onCategory: (ChannelCategory) -> Unit) {
|
||||
internal fun HomeScreen(channels: List<SampleChannel>, modifier: Modifier = Modifier, onCategory: (ChannelCategory) -> Unit,
|
||||
/** Continue watching, newest first (Paul, 8 November 2026): one press back into a half-watched programme. */
|
||||
carryOn: List<ContinueEntry> = emptyList(), onResume: (ContinueEntry) -> Unit = {}) {
|
||||
val firstFocus = remember { FocusRequester() }
|
||||
val nav = LocalNavFocus.current
|
||||
LaunchedEffect(Unit) { runCatching { firstFocus.requestFocus() } }
|
||||
@@ -87,6 +92,23 @@ internal fun HomeScreen(channels: List<SampleChannel>, modifier: Modifier = Modi
|
||||
}
|
||||
}
|
||||
} }
|
||||
// Words only, no pictures, so Home stays as quick as it is.
|
||||
if (carryOn.isNotEmpty()) {
|
||||
Spacer(Modifier.height(14.dp))
|
||||
Text("CONTINUE WATCHING", Modifier.width(400.dp), color = Yellow, fontFamily = Anton, fontSize = 13.sp)
|
||||
Spacer(Modifier.height(4.dp))
|
||||
CompositionLocalProvider(LocalGlide provides glide) { Column(Modifier.width(400.dp).glideArea(glide, Yellow, 6.dp), verticalArrangement = Arrangement.spacedBy(4.dp)) {
|
||||
carryOn.take(HOME_CONTINUE_MAX).forEach { c ->
|
||||
HomeCard(Modifier.fillMaxWidth().height(31.dp), onClick = { onResume(c) }) { focused ->
|
||||
Row(Modifier.fillMaxSize().padding(horizontal = 16.dp), verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(10.dp)) {
|
||||
Text(guideTitle(c.entry.channel.number, c.entry.show).first, Modifier.weight(1f), color = if (focused) OnAccent else Ink, fontSize = 14.sp,
|
||||
fontWeight = FontWeight.SemiBold, maxLines = 1, overflow = androidx.compose.ui.text.style.TextOverflow.Ellipsis)
|
||||
Text(leftLabel(c.leftMs), color = if (focused) OnAccent else Muted, fontSize = 12.sp, maxLines = 1)
|
||||
}
|
||||
}
|
||||
}
|
||||
} }
|
||||
}
|
||||
Spacer(Modifier.height(14.dp))
|
||||
Text("Tonight's Pick and the evening's highlights are in What's On", color = Muted, fontSize = 11.sp)
|
||||
Spacer(Modifier.weight(1f))
|
||||
|
||||
@@ -45,7 +45,10 @@ internal class CompanionScreen(
|
||||
val director: () -> DeskReport? = { null },
|
||||
val place: (ChairChoice, Int) -> Unit = { _, _ -> },
|
||||
val drop: (ChairChoice) -> Unit = {},
|
||||
val decideIdea: (DeskEventIdea, String) -> String = { _, _ -> "" })
|
||||
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 = { _, _, _, _ -> })
|
||||
|
||||
/**
|
||||
* Phase 2's queue (Paul, 6 November 2026): what plays when the programme on now ends. A channel, live from then ("switch
|
||||
@@ -138,18 +141,28 @@ internal object OrbitCompanion {
|
||||
/** Every channel's now and next. */
|
||||
fun guide(screen: CompanionScreen, nowMs: Long): JSONObject = JSONObject().put("selected", screen.selected()).put("serverMs", nowMs).put("channels",
|
||||
JSONArray(screen.channels().map { c -> val on = c.at(nowMs)
|
||||
channelJson(c).put("category", ChannelBrands.forNumber(c.number)?.category?.label ?: JSONObject.NULL).put("now", programme(on)).put("next", programme(c.at(on.endMs))) }))
|
||||
channelJson(c).put("category", ChannelBrands.forNumber(c.number)?.category?.label ?: JSONObject.NULL).put("now", programme(on)).put("next", programme(c.at(on.endMs)).let { next ->
|
||||
next.put("reminded", screen.reminders().any { it.channel == c.number && it.startMs == next.getLong("startMs") }) }) }))
|
||||
|
||||
fun catchUp(screen: CompanionScreen, nowMs: Long): JSONArray = JSONArray(catchUpShelves(screen.channels(), nowMs).map { shelf ->
|
||||
JSONObject().put("title", shelf.title).put("entries", JSONArray(shelf.entries.map { e ->
|
||||
programme(e.show).put("number", e.channel.number).put("channel", e.channel.name).put("continues", e.continues) }))
|
||||
})
|
||||
|
||||
/** A reminder from the phone, for a programme still to come on a channel this TV shows; false when there's no such programme. */
|
||||
fun remind(screen: CompanionScreen, number: Int, startMs: Long, on: Boolean, nowMs: Long): Boolean {
|
||||
val c = screen.channels().firstOrNull { it.number == number } ?: return false
|
||||
val show = runCatching { c.at(startMs) }.getOrNull()?.takeIf { it.startMs == startMs && it.startMs > nowMs } ?: return false
|
||||
screen.remind(number, startMs, guideTitle(number, show).first, on); return true
|
||||
}
|
||||
|
||||
/** The Catch Up programme the phone chose, only if it's still in Catch Up on a channel this TV shows. */
|
||||
fun catchUpEntry(screen: CompanionScreen, number: Int, startMs: Long, nowMs: Long): CatchUpEntry? =
|
||||
catchUpShelves(screen.channels(), nowMs).flatMap { it.entries }.firstOrNull { it.channel.number == number && it.show.startMs == startMs }
|
||||
|
||||
const val QUEUE_MAX = 5
|
||||
const val TIMES_DAYS = 7
|
||||
const val TIMES_FILMS = 12
|
||||
/** How long before the programme's end the queue takes over. */
|
||||
const val QUEUE_LEAD_MS = 2_500L
|
||||
var queue by mutableStateOf<List<Queued>>(emptyList())
|
||||
@@ -209,6 +222,42 @@ internal object OrbitCompanion {
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Orbit TV Times (Paul, 8 November 2026): the week ahead as a listings magazine, from the real schedules. Each day is
|
||||
* What's On's choice for that evening (its pick and highlights), the evening's films across the channels, and the
|
||||
* Drive-In's bills, only for the channels this TV shows now (Kids' own, and After Dark only while unlocked).
|
||||
*/
|
||||
fun times(screen: CompanionScreen, nowMs: Long, zone: java.time.ZoneId = java.time.ZoneId.systemDefault()): JSONObject {
|
||||
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) }
|
||||
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)
|
||||
}
|
||||
val first = whatsOnEdition(nowMs, zone)
|
||||
val days = JSONArray()
|
||||
for (d in 0 until TIMES_DAYS) {
|
||||
val date = first.plusDays(d.toLong())
|
||||
val noon = maxOf(nowMs, date.atTime(12, 0).atZone(zone).toInstant().toEpochMilli())
|
||||
val evening = date.atTime(18, 0).atZone(zone).toInstant().toEpochMilli(); val night = date.plusDays(1).atTime(0, 0).atZone(zone).toInstant().toEpochMilli()
|
||||
val end = date.plusDays(1).atTime(6, 0).atZone(zone).toInstant().toEpochMilli()
|
||||
val page = whatsOnPage(plans, null, noon, zone)
|
||||
val films = plans.flatMap { (n, plan) -> plan.entries.filter { it.media.item.type == "Movie" && it.startMs in evening until night && !kidsAsleep(takeoverOf(n, it, zone)) }.map { n to it } }
|
||||
.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
|
||||
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) }))
|
||||
.put("films", JSONArray(films.map { (n, e) -> item(n, e, null, null) }))
|
||||
.put("drivein", JSONArray(bills.map { b -> JSONObject().put("kind", b.kind.label).put("event", b.event ?: JSONObject.NULL).put("startMs", b.startMs).put("endMs", b.endMs)
|
||||
.put("films", JSONArray(b.entries.map { guideTitleParts(it.media.item.title).first })) })))
|
||||
}
|
||||
return JSONObject().put("generatedMs", nowMs).put("room", Rooms.name).put("days", days)
|
||||
}
|
||||
|
||||
// --- Phase 3: Director approvals and profiles. ---
|
||||
private fun choiceJson(c: ChairChoice) = JSONObject().put("id", c.id).put("title", c.title).put("type", c.type).put("year", c.year ?: JSONObject.NULL)
|
||||
.put("line", c.line).put("ask", c.ask).put("options", JSONArray(c.options.map { JSONObject().put("number", it.number).put("name", it.name).put("reason", it.reason) }))
|
||||
|
||||
@@ -241,6 +241,7 @@ internal object PhoneLink {
|
||||
phone == null -> page(out, PhonePages.join(null))
|
||||
r.path == "/" -> page(out, PhonePages.companion())
|
||||
r.path == "/create" -> page(out, PhonePages.app())
|
||||
r.path == "/times" -> page(out, PhonePages.times())
|
||||
r.method == "POST" && r.headers["x-orbit"] != "1" -> json(out, 403, JSONObject().put("error", "Refused"))
|
||||
else -> api(r, out, phone)
|
||||
}
|
||||
@@ -479,7 +480,7 @@ internal object PhoneLink {
|
||||
}
|
||||
|
||||
private val companionRoutes = setOf("GET /api/now", "GET /api/guide", "GET /api/catchup", "GET /api/rooms", "GET /api/looks", "POST /api/key", "POST /api/volume",
|
||||
"POST /api/channel", "POST /api/tune", "POST /api/section", "POST /api/catchup/watch",
|
||||
"POST /api/channel", "POST /api/tune", "POST /api/remind", "GET /api/times", "POST /api/section", "POST /api/catchup/watch",
|
||||
"GET /api/queue", "POST /api/queue", "POST /api/queue/remove", "GET /api/drivein", "POST /api/drivein/ticket", "POST /api/drivein/watch",
|
||||
"GET /api/director", "POST /api/director/place", "POST /api/director/drop", "POST /api/director/idea", "GET /api/profiles", "POST /api/profile",
|
||||
"POST /api/profile/add", "POST /api/profile/rename", "POST /api/profile/remove")
|
||||
@@ -516,6 +517,13 @@ internal object PhoneLink {
|
||||
val number = body().optInt("number").takeIf { n -> s.channels().any { it.number == n } } ?: return json(out, 404, JSONObject().put("error", "That channel isn't on this TV right now."))
|
||||
onScreen { s.tune(number, 0) }; json(out, 200, JSONObject().put("number", number))
|
||||
}
|
||||
"GET /api/times" -> json(out, 200, OrbitCompanion.times(s, now))
|
||||
"POST /api/remind" -> {
|
||||
val o = body(); var done = false
|
||||
onScreen { done = OrbitCompanion.remind(s, o.optInt("number"), o.optLong("startMs"), o.optBoolean("on", true), now) }
|
||||
if (!done) return json(out, 404, JSONObject().put("error", "That programme isn't coming up on this TV."))
|
||||
json(out, 200, JSONObject().put("ok", true))
|
||||
}
|
||||
"POST /api/section" -> {
|
||||
val section = OrbitCompanion.sections[body().optString("section")] ?: return json(out, 400, JSONObject().put("error", "Unknown place"))
|
||||
onScreen { OrbitCompanion.open(section) }; json(out, 200, JSONObject().put("ok", true))
|
||||
|
||||
@@ -21,6 +21,7 @@ background:#ffde59;color:#071632;font-size:18px;font-weight:700}.note{color:#ffd
|
||||
fun app(): String = asset("app.html")
|
||||
/** The Companion, at /: Remote, Guide, Catch Up, Rooms and More (which leads to Create your own). */
|
||||
fun companion(): String = asset("companion.html")
|
||||
fun times(): String = asset("times.html")
|
||||
/** For "Add to home screen": Orbit's icon and name, opening on the remote. */
|
||||
val icons = setOf("/icon-180.png", "/icon-192.png", "/icon-512.png")
|
||||
fun icon(path: String): ByteArray? = runCatching { PhoneLink.context()?.assets?.open("phone" + path)?.use { it.readBytes() } }.getOrNull()
|
||||
|
||||
@@ -69,7 +69,7 @@ internal enum class RoomPart(val title: String, val line: String) {
|
||||
}
|
||||
|
||||
/** On screen and Arcade settings that may travel; the sound output and anything about this box stay where they are. */
|
||||
private val LookKeys = listOf("look", "subtitles_on", "channel_logo", "idents", "ident_sound", "special_idents", "block_ident_sound", "squeeze_back",
|
||||
private val LookKeys = listOf("look", "subtitles_on", "channel_logo", "idents", "ident_sound", "special_idents", "block_ident_sound", "squeeze_back", "up_next",
|
||||
"cast_on", "drive_in_intro", "reduce_motion")
|
||||
private val ArcadeKeys = listOf("snake_best", "block_drop_best", "brick_break_best", "pairs_best", "patience_wins", "orb_man_best", "blast_best", "skydoku_solved", "snake_music")
|
||||
private val DirectorFiles = listOf("director-decisions-0.json", "director-learning-0.json", "event-ideas-history-0.json")
|
||||
|
||||
@@ -71,6 +71,7 @@ internal fun ScheduledChannelPlayer(session: EmbySampleSession, channel: SampleC
|
||||
val squeezeOn = remember { OrbitSettings(settingsContext).squeezeBack }
|
||||
val cameosOn = remember { OrbitSettings(settingsContext).let { it.characterCameos && it.castOn } }
|
||||
val calmMotion = remember { OrbitSettings(settingsContext).reduceMotion }
|
||||
val upNextOn = remember { OrbitSettings(settingsContext).upNext }
|
||||
val squeezing = squeezeOn && channel is ScheduledChannel && squeezeBackDue(channel.number, current.startMs, current.endMs, next.startMs, now, if (identsHere) identMs else 0L, clockOffsetMs, squeezeLength(current.media.item.type))
|
||||
val squeeze by androidx.compose.animation.core.animateFloatAsState(if (squeezing) 1f else 0f,
|
||||
if (calmMotion) androidx.compose.animation.core.snap() else androidx.compose.animation.core.tween(1_000), label = "squeeze")
|
||||
@@ -218,6 +219,8 @@ internal fun ScheduledChannelPlayer(session: EmbySampleSession, channel: SampleC
|
||||
}
|
||||
}
|
||||
if (plan != null && squeeze > 0f) SqueezePanel(session, channel, current, next, now, squeeze)
|
||||
if (plan != null && upNextOn && squeeze == 0f && phase == IdentPhase.None && channel is ScheduledChannel && clockOffsetMs == 0L && next.startMs == current.endMs)
|
||||
UpNextBanner(channel, current, next, now)
|
||||
heldIdent?.let { held ->
|
||||
key(held.startMs) {
|
||||
val early = endedEarly == held.startMs
|
||||
|
||||
@@ -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.109")
|
||||
next.setRequestProperty("User-Agent", "OrbitTV/0.110.0")
|
||||
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()) {
|
||||
|
||||
@@ -102,6 +102,10 @@ internal class OrbitSettings(context: Context) {
|
||||
var identSoundNightQuiet: Boolean
|
||||
get() = saved.getBoolean("ident_sound_night_quiet", true)
|
||||
set(value) { saved.edit().putBoolean("ident_sound_night_quiet", value).apply() }
|
||||
/** A small "Coming up next" card near the end of each programme (Paul, 8 November 2026). On by default. */
|
||||
var upNext: Boolean
|
||||
get() = saved.getBoolean("up_next", true)
|
||||
set(value) { saved.edit().putBoolean("up_next", value).apply() }
|
||||
var driveInIntro: Boolean
|
||||
get() = saved.getBoolean("drive_in_intro", true)
|
||||
set(value) { saved.edit().putBoolean("drive_in_intro", value).apply() }
|
||||
@@ -270,6 +274,7 @@ private fun ViewingDetail(firstSwitch: FocusRequester, modifier: Modifier, top:
|
||||
var identSound by remember { mutableStateOf(settings.identSound) }
|
||||
var identSoundQuiet by remember { mutableStateOf(settings.identSoundQuiet) }
|
||||
var identSoundNightQuiet by remember { mutableStateOf(settings.identSoundNightQuiet) }
|
||||
var upNext by remember { mutableStateOf(settings.upNext) }
|
||||
var driveInIntro by remember { mutableStateOf(settings.driveInIntro) }
|
||||
var reduceMotion by remember { mutableStateOf(settings.reduceMotion) }
|
||||
var squeezeBack by remember { mutableStateOf(settings.squeezeBack) }
|
||||
@@ -300,6 +305,9 @@ private fun ViewingDetail(firstSwitch: FocusRequester, modifier: Modifier, top:
|
||||
SettingLine("Quieter late at night", "From 11pm to 7am, ident sounds play softly on their own, so nobody's woken.") {
|
||||
OnOff(identSoundNightQuiet, Modifier, enabled = identSound && !identSoundQuiet, onClick = { identSoundNightQuiet = !identSoundNightQuiet; settings.identSoundNightQuiet = identSoundNightQuiet })
|
||||
}
|
||||
SettingLine("Coming up next", "Near the end of a programme, a small card in the corner says what's on next.") {
|
||||
OnOff(upNext, Modifier, onClick = { upNext = !upNext; settings.upNext = upNext })
|
||||
}
|
||||
SettingLine("Special idents", "Give named blocks and events their own ident as they begin, such as Riot Laughs or PPV Sunday. Off uses each channel's usual ident.") {
|
||||
OnOff(specialIdents, Modifier, onClick = { specialIdents = !specialIdents; settings.specialIdents = specialIdents })
|
||||
}
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
package tv.orbit.classic
|
||||
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.border
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableLongStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import androidx.tv.material3.Text
|
||||
|
||||
/**
|
||||
* Coming up next (Paul, 8 November 2026): near the end of a programme, a small card in the corner names what's on next, as
|
||||
* a channel would, for [UP_NEXT_SHOW_MS] and once per programme. It comes in the last few minutes, before the squeeze-back
|
||||
* and the ident, so they never overlap.
|
||||
*/
|
||||
internal const val UP_NEXT_FROM_MS = 3 * 60_000L
|
||||
internal const val UP_NEXT_UNTIL_MS = 75_000L
|
||||
internal const val UP_NEXT_SHOW_MS = 10_000L
|
||||
|
||||
/** Whether the card may start now, with [remainingMs] of the programme left. */
|
||||
internal fun upNextMayStart(remainingMs: Long) = remainingMs in (UP_NEXT_UNTIL_MS + 1)..UP_NEXT_FROM_MS
|
||||
|
||||
/** The words on the card: "in 3 min", or "next" in the final minute or so. */
|
||||
internal fun upNextWhen(remainingMs: Long): String = ((remainingMs + 59_999) / 60_000).let { m -> if (m <= 1) "in a minute" else "in $m min" }
|
||||
|
||||
@Composable
|
||||
internal fun UpNextBanner(channel: SampleChannel, current: SampleBroadcast, next: SampleBroadcast, now: Long, modifier: Modifier = Modifier) {
|
||||
// Kids never sees what a grown-up takeover will show, and nothing is named when the channel goes to sleep.
|
||||
if (kidsAsleep(takeoverOf(channel.number, next))) return
|
||||
var until by remember(current.startMs) { mutableLongStateOf(0L) }
|
||||
val remaining = current.endMs - now
|
||||
LaunchedEffect(current.startMs, upNextMayStart(remaining)) { if (until == 0L && upNextMayStart(remaining)) until = now + UP_NEXT_SHOW_MS }
|
||||
if (until == 0L || now >= until) return
|
||||
val (title, detail) = guideTitle(channel.number, next)
|
||||
val corner = RoundedCornerShape(10.dp)
|
||||
Box(Modifier.fillMaxSize().padding(36.dp), contentAlignment = Alignment.BottomEnd) {
|
||||
Column(modifier.riseIn(0).widthIn(max = 460.dp).background(Navy.copy(alpha = .94f), corner).border(2.dp, Yellow, corner).padding(horizontal = 18.dp, vertical = 12.dp),
|
||||
verticalArrangement = Arrangement.spacedBy(3.dp)) {
|
||||
Text("COMING UP NEXT • ${upNextWhen(remaining).uppercase()}", color = Yellow, fontFamily = Anton, fontSize = 14.sp)
|
||||
Text(title, color = Ink, fontSize = 20.sp, fontWeight = FontWeight.SemiBold, maxLines = 1, overflow = TextOverflow.Ellipsis)
|
||||
Text(listOfNotNull(detail, "${channel.number} ${ChannelBrands.displayName(channel)}").joinToString(" • "), color = Muted, fontSize = 13.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user