0.108.39: channel takeovers

Paul, 6 November 2026, from the approved design, with the late-night cast.
ToonZ becomes ToonZ Late (22:00-05:00, grown-up animation, Blaze); Junior
becomes Nite Owl (21:00-06:00, classic sitcoms, Nite Owl); Tots becomes
Tots Dreamtime (19:00-06:00, its bedtime shows, Luna in her nightcap);
Terra becomes Terra Starlight (22:00-06:00, space and the night sky,
Drift). Each is a block of its channel's day with its own titles (checked
against the library), so it shows from the nights planned after this
install; committed bookings are untouched. Dreamtime only renames Tots'
bedtime hours, so it shows at once.

While one is on, the guide row and the corner mark wear its name and
colour, and its own drawn ident plays as it starts. Kids never sees a
grown-up takeover: the channel shows Luna, asleep till 6am, and its night
programmes stay out of the guide, What's On, Catch Up and promos.
Junior's pool may now pass 60 series, so presets keep every title.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-11-06 01:45:54 +00:00
co-authored by Claude Opus 5.5
parent 99bf39cbeb
commit a9fd9fae8c
14 changed files with 271 additions and 24 deletions
@@ -17,7 +17,8 @@ class PresentationTest {
private fun broadcast(key: String, title: String = "Show / S1 E1 / One") = SampleBroadcast(ScheduledMedia(SampleItem(title, "Episode", 30, "", "i", 30 * 60_000L), "c", 30 * 60_000L), 0, key)
@Test fun everyApprovedBlockKeyHasItsIdent() {
val keys = SmartChannels.flatMap { it.dayParts }.map { it.key }.filter { it.isNotEmpty() }.toSet()
// Takeovers (6 November 2026) have their own drawn ident instead of a filmed one.
val keys = SmartChannels.flatMap { it.dayParts }.map { it.key }.filter { it.isNotEmpty() }.toSet() - Takeovers.map { it.key }.toSet()
// Riot 3, After Dark 3, Horror, Gold, Three, Vortex 4 (Movie Night, Prime, Afterburn and its premiere), Orbit 2 2, Ring X 7 (six nights and PPV), Terra.
assertEquals(23, keys.size)
assertEquals(emptySet<String>(), keys - BlockIdents.keys)
@@ -0,0 +1,45 @@
package tv.orbit.classic
import org.junit.After
import org.junit.Assert.*
import org.junit.Test
import java.time.ZoneId
import java.time.ZonedDateTime
class TakeoversTest {
private val london = ZoneId.of("Europe/London")
private fun at(h: Int) = ZonedDateTime.of(2026, 11, 6, h, 0, 0, 0, london).toInstant().toEpochMilli()
private fun show(start: Long, presentation: String = "") = SampleBroadcast(ScheduledMedia(SampleItem("A / S1 E1 / B", "Episode", 30, "", "i$start", 1_800_000), "s", 1_800_000), start, presentation)
@After fun reset() { Profiles.current = null }
@Test fun eachTakeoverIsANightBlockOfItsChannelAndEveryHourIsCoveredOnce() {
for (t in listOf(TOONZ_LATE, NITE_OWL, TERRA_STARLIGHT)) {
val parts = SmartChannels.single { it.number == t.channel }.dayParts.filter { it.days.isEmpty() }
assertTrue(parts.any { it.key == t.key && it.titles == t.titles })
for (h in 0..23) assertEquals("channel ${t.channel} hour $h", 1, parts.count { it.covers(h) })
// Its shows are in the channel's pool.
assertTrue(SmartChannels.single { it.number == t.channel }.searches.containsAll(t.titles))
}
// Junior's pool now goes past the usual 60 series, and keeps them all.
val junior = SmartChannels.single { it.number == 611 }
assertTrue(junior.seriesCount >= junior.searches.size)
}
@Test fun aTakeoverIsKnownByItsBlockOrForDreamtimeByTheClock() {
assertEquals(TOONZ_LATE, takeoverOf(605, show(at(23), "toonz.late"), london))
// Booked before the takeover was added: still ToonZ.
assertNull(takeoverOf(605, show(at(23)), london))
assertNull(takeoverOf(605, show(at(15), ""), london))
assertEquals(TOTS_DREAMTIME, takeoverOf(TOTS_NUMBER, show(at(20)), london))
assertNull(takeoverOf(TOTS_NUMBER, show(at(10)), london))
assertEquals("5am", TOONZ_LATE.backAt); assertEquals("6am", NITE_OWL.backAt)
}
@Test fun kidsNeverSeesAGrownUpTakeover() {
Profiles.current = DefaultProfiles.first { it.kind == ProfileKind.Kids }
assertTrue(kidsAsleep(TOONZ_LATE)); assertTrue(kidsAsleep(NITE_OWL))
assertFalse(kidsAsleep(TOTS_DREAMTIME)); assertFalse(kidsAsleep(TERRA_STARLIGHT)); assertFalse(kidsAsleep(null))
Profiles.current = DefaultProfiles.first { it.kind == ProfileKind.Grown }
assertFalse(kidsAsleep(TOONZ_LATE))
}
}
@@ -211,7 +211,9 @@ class WeightedRotationTest {
assertEquals(TIER_SURPRISE, SmartChannels.first { it.number == 203 }.weightOf(show("Dirty Jobs", 100, 60)), 0.0)
assertEquals(TIER_CORE, SmartChannels.first { it.number == 603 }.weightOf(show("Mighty Morphin Power Rangers", 100, 60)), 0.0)
assertEquals(TIER_CORE, SmartChannels.first { it.number == 202 }.weightOf(show("Cosmos", 100, 60)), 0.0)
assertTrue(SmartChannels.filter { it.number != 614 && it.number != 605 }.all { p -> p.dayParts.all { it.weighted && it.weights.isEmpty() } })
// A takeover's block takes equal turns (6 November 2026); everything else on these channels is weighted as before.
val takeoverKeys = Takeovers.map { it.key }.toSet()
assertTrue(SmartChannels.filter { it.number != 614 && it.number != 605 }.all { p -> p.dayParts.filter { it.key !in takeoverKeys }.all { it.weighted && it.weights.isEmpty() } })
}
@Test fun aShortCatalogueHasItsWeightScaledDownAndSoRepeatsLessOften() {