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:
@@ -145,7 +145,9 @@ class PhoneLinkTest {
|
||||
val pressed = mutableListOf<Int>(); val volume = mutableListOf<Int>()
|
||||
OrbitCompanion.inject = { synchronized(pressed) { pressed += it } }; OrbitCompanion.volume = { volume += it }
|
||||
PhoneLink.clock = { now }
|
||||
PhoneLink.screen = CompanionScreen({ companionChannels }, { selected }, { true }, { 0 }, { n, o -> tuned += n to o; selected = n })
|
||||
val reminders = mutableListOf<ProgrammeReminder>()
|
||||
PhoneLink.screen = CompanionScreen({ companionChannels }, { selected }, { true }, { 0 }, { n, o -> tuned += n to o; selected = n },
|
||||
reminders = { reminders.toList() }, remind = { n, start, title, on -> reminders.removeAll { it.channel == n && it.startMs == start }; if (on) reminders += ProgrammeReminder(n, start, title) })
|
||||
try {
|
||||
assertTrue(call("/api/now").body.contains("Enter the code")) // not joined: nothing
|
||||
// The home-screen manifest needs no phone, and carries Orbit's name only.
|
||||
@@ -191,6 +193,19 @@ class PhoneLinkTest {
|
||||
assertEquals(0, JSONObject(call("/api/drivein", cookie = cookie).body).getJSONArray("bills").length())
|
||||
assertEquals(404, call("/api/drivein/ticket", "POST", """{"startMs":1}""", cookie = cookie).status)
|
||||
assertEquals(409, call("/api/drivein/watch", "POST", "{}", cookie = cookie).status)
|
||||
// Reminders from the phone (8 November 2026): only for a programme still to come on a channel this TV shows.
|
||||
val next = JSONObject(call("/api/guide", cookie = cookie).body).getJSONArray("channels").getJSONObject(0).getJSONObject("next")
|
||||
assertFalse(next.getBoolean("reminded"))
|
||||
assertEquals(200, call("/api/remind", "POST", """{"number":101,"startMs":${next.getLong("startMs")},"on":true}""", cookie = cookie).status)
|
||||
assertEquals(listOf(101 to "Friends"), reminders.map { it.channel to it.title })
|
||||
assertTrue(JSONObject(call("/api/guide", cookie = cookie).body).getJSONArray("channels").getJSONObject(0).getJSONObject("next").getBoolean("reminded"))
|
||||
assertEquals(404, call("/api/remind", "POST", """{"number":999,"startMs":${next.getLong("startMs")}}""", cookie = cookie).status)
|
||||
assertEquals(404, call("/api/remind", "POST", """{"number":101,"startMs":${next.getLong("startMs") + 1}}""", cookie = cookie).status)
|
||||
assertEquals(200, call("/api/remind", "POST", """{"number":101,"startMs":${next.getLong("startMs")},"on":false}""", cookie = cookie).status)
|
||||
assertTrue(reminders.isEmpty())
|
||||
// Orbit TV Times: the page and its listings, for a joined phone.
|
||||
assertTrue(call("/times", cookie = cookie).status == 200)
|
||||
assertTrue(JSONObject(call("/api/times", cookie = cookie).body).has("days"))
|
||||
// Titles and times only.
|
||||
val everything = call("/api/now", cookie = cookie).body + call("/api/guide", cookie = cookie).body + call("/api/rooms", cookie = cookie).body
|
||||
listOf("token", "api_key", "password", "X-Emby", "MediaBrowser", "s-a1", "a1").forEach { assertFalse(it, everything.contains("\"$it\"", ignoreCase = true)) }
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
package tv.orbit.classic
|
||||
|
||||
import org.junit.Assert.*
|
||||
import org.junit.Test
|
||||
import java.time.ZoneId
|
||||
import java.time.ZonedDateTime
|
||||
|
||||
/** 8 November 2026: the Coming up next card's timing, and Orbit TV Times built from real plans. */
|
||||
class UpNextAndTimesTest {
|
||||
private val minute = 60_000L
|
||||
@Test fun comingUpNextShowsBetweenThreeMinutesAndTheSqueeze() {
|
||||
assertFalse(upNextMayStart(3 * minute + 1)); assertTrue(upNextMayStart(3 * minute)); assertTrue(upNextMayStart(76_000))
|
||||
assertFalse(upNextMayStart(75_000)); assertFalse(upNextMayStart(10_000))
|
||||
assertEquals("in 3 min", upNextWhen(3 * minute)); assertEquals("in 2 min", upNextWhen(90_000)); assertEquals("in a minute", upNextWhen(50_000))
|
||||
}
|
||||
|
||||
@Test fun tvTimesListsEachEveningsFilmsAndPicksFromThePlans() {
|
||||
val zone = ZoneId.of("Europe/London")
|
||||
val day = ZonedDateTime.of(2026, 11, 9, 13, 0, 0, 0, zone).toInstant().toEpochMilli()
|
||||
val eight = ZonedDateTime.of(2026, 11, 9, 20, 0, 0, 0, zone).toInstant().toEpochMilli()
|
||||
fun film(id: String, title: String, at: Long) = ScheduleEntry("", EpisodeMark(0, 0), ScheduledMedia(SampleItem(title, "Movie", 100, "", id, 100 * minute), "s-$id", 100 * minute), at)
|
||||
val plan = ChannelPlan(listOf(film("f1", "Hot Fuzz", eight), film("f2", "Paul", eight + 100 * minute)), ScheduleCursor())
|
||||
val channel = ScheduledChannel(SampleChannel(plan.entries.map { it.media }, "BritX", 309), plan)
|
||||
val screen = CompanionScreen({ listOf(channel) }, { 309 }, { false }, { 0 }, { _, _ -> })
|
||||
val times = OrbitCompanion.times(screen, day, zone)
|
||||
val first = times.getJSONArray("days").getJSONObject(0)
|
||||
assertEquals("2026-11-09", first.getString("date"))
|
||||
val films = first.getJSONArray("films")
|
||||
assertEquals(listOf("Hot Fuzz", "Paul"), (0 until films.length()).map { films.getJSONObject(it).getString("title") })
|
||||
assertEquals(309, films.getJSONObject(0).getInt("channel"))
|
||||
// Ids and sources never go to the phone.
|
||||
assertFalse(times.toString().contains("s-f1")); assertFalse(times.toString().contains("\"f1\""))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user