Quicker open; Tonight on Orbit 2 with a picture (0.108.55)

- validId built a Regex on every call. It runs thousands of times as the saved sign-in is
  read and checked (4.3 s of decoding on the box), so it's now a plain loop. The catalogue
  title key's pattern is compiled once too.
- Promos: "Tonight on Orbit 2" rather than "on 2"; the picture tries the show's backdrop and
  poster as well as the episode's, and with none the channel's logo shows, not an empty box.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-11-06 13:10:23 +00:00
co-authored by Claude Opus 5.5
parent 6b65a230ea
commit aec611bf8f
9 changed files with 30 additions and 13 deletions
@@ -12,7 +12,7 @@ class ProgrammeArtworkTest {
private val png = byteArrayOf(1, 2, 3)
@Test fun theShowsWideArtworkIsTriedFirst() {
assertEquals(listOf("/Items/show/Images/Backdrop?maxWidth=1280&quality=80", "/Items/ep/Images/Backdrop?maxWidth=1280&quality=80", "/Items/ep/Images/Primary?maxWidth=1280&quality=80"), artworkPaths("ep", "show"))
assertEquals(listOf("/Items/show/Images/Backdrop?maxWidth=1280&quality=80", "/Items/ep/Images/Backdrop?maxWidth=1280&quality=80", "/Items/ep/Images/Primary?maxWidth=1280&quality=80", "/Items/show/Images/Primary?maxWidth=1280&quality=80"), artworkPaths("ep", "show"))
}
@Test fun aFilmOnlyAsksForItsOwnArtwork() {
@@ -32,6 +32,7 @@ class PromosTest {
val now = at(6, 18)
assertEquals("TONIGHT AT THE DRIVE-IN", promoHeadline(item(DRIVE_IN_NUMBER, at(6, 20)), now, london))
assertEquals("TONIGHT ON ACTION", promoHeadline(item(302, at(6, 21)), now, london))
assertEquals("TONIGHT ON ORBIT 2", promoHeadline(item(102, at(6, 21)), now, london)) // not "on 2"
assertEquals("TONIGHT ON ACTION", promoHeadline(item(302, at(7, 1)), now, london))
assertEquals("TOMORROW ON ACTION", promoHeadline(item(302, at(7, 20)), now, london))
assertEquals("LATER ON ACTION", promoHeadline(item(302, at(6, 15)), at(6, 12), london))