From 56cceec2673db4f47af45c7dacff58a2d9b2579f Mon Sep 17 00:00:00 2001 From: Pauljd Date: Mon, 30 Nov 2026 10:31:29 +0000 Subject: [PATCH] Orbit Stories: teen and young-adult strand, wave 1 Paul, 30 November 2026 (option A, two waves): After School grows to 16:00 to 20:00 with Waterloo Road, The Secret Life of the American Teenager, Glee, 90210, Switched at Birth and Felicity; Pretty Little Liars and Riverdale from 20:00. Newcomers are supporting so Stories' own series keep their place. Five-week simulation: bookings kept, no clashes, gaps, repeats or broken order; Stories' teen dramas keep 97% of their airtime. 13 Reasons Why and XO, Kitty held; wave 2 later. Co-Authored-By: Claude Opus 5.5 --- .../src/main/java/tv/orbit/classic/Stories.kt | 20 ++++++++++---- .../tv/orbit/classic/NewFilmChannelsTest.kt | 6 ++++- .../classic/StoriesTeenSimulationTest.kt | 27 ++++++++++++------- 3 files changed, 38 insertions(+), 15 deletions(-) diff --git a/android/app/src/main/java/tv/orbit/classic/Stories.kt b/android/app/src/main/java/tv/orbit/classic/Stories.kt index 459d05c8..295b916a 100644 --- a/android/app/src/main/java/tv/orbit/classic/Stories.kt +++ b/android/app/src/main/java/tv/orbit/classic/Stories.kt @@ -17,12 +17,22 @@ private val StoriesPrimetime = listOf("ER", "Grey's Anatomy", "House", "This Is /** Mature series, late only. Shameless is the Channel 4 original. */ private val StoriesLate = listOf("Skins", "Shameless", "Euphoria (US)", "Ally McBeal", "The Practice", "Boston Legal", "Sex Education", "Picket Fences") -internal val StoriesShows get() = (StoriesMornings + StoriesWards + StoriesAfterSchool + StoriesPrimetime + StoriesLate).distinct() +/** + * The teen and young-adult strand, wave 1 (Paul, 30 November 2026, option A: audit-20261130-teen and the doc "Teen and + * young-adult drama audit"): the eight longest of the approved series. After School grows to 16:00 to 20:00. Riverdale and + * Pretty Little Liars carry murder and stalking, so they play from 20:00. Wave 2 waits until these have run a season; 13 + * Reasons Why and XO, Kitty are held. Stories' own teen dramas keep their After School home. + */ +private val StoriesTeenAfterSchool = listOf("Waterloo Road", "The Secret Life of the American Teenager", "Glee", "90210", "Switched at Birth", "Felicity") +private val StoriesTeenPrimetime = listOf("Pretty Little Liars", "Riverdale") + +internal val StoriesShows get() = (StoriesMornings + StoriesWards + StoriesAfterSchool + StoriesTeenAfterSchool + StoriesPrimetime + StoriesTeenPrimetime + StoriesLate).distinct() internal val StoriesDayParts get() = listOf( - DayPart(6, 12, StoriesMornings), DayPart(12, 17, StoriesWards), DayPart(17, 20, StoriesAfterSchool), DayPart(20, 23, StoriesPrimetime), + DayPart(6, 12, StoriesMornings), DayPart(12, 16, StoriesWards), DayPart(16, 20, StoriesAfterSchool + StoriesTeenAfterSchool), DayPart(20, 23, StoriesPrimetime + StoriesTeenPrimetime), DayPart(23, 2, StoriesLate, key = "stories.afterhours"), // Overnight repeats: the grown-up evening and late series, so nothing mature reaches the daytime. - DayPart(2, 6, StoriesPrimetime + StoriesLate)) -/** Tiers: Casualty and Holby City have 550 episodes or more each, so they're supporting and the rest core. */ + DayPart(2, 6, StoriesPrimetime + StoriesTeenPrimetime + StoriesLate)) +/** Tiers: Casualty and Holby City have 550 episodes or more each, so they're supporting, as are the teen strand's newcomers; the rest core. */ internal val StoriesTiers: Map get() = - (StoriesShows - setOf("Casualty", "Holby City")).associate { seriesKey(it) to TIER_CORE } + listOf("Casualty", "Holby City").associate { seriesKey(it) to TIER_SUPPORTING } + (StoriesShows - setOf("Casualty", "Holby City") - (StoriesTeenAfterSchool + StoriesTeenPrimetime).toSet()).associate { seriesKey(it) to TIER_CORE } + + (listOf("Casualty", "Holby City") + StoriesTeenAfterSchool + StoriesTeenPrimetime).associate { seriesKey(it) to TIER_SUPPORTING } diff --git a/android/app/src/test/java/tv/orbit/classic/NewFilmChannelsTest.kt b/android/app/src/test/java/tv/orbit/classic/NewFilmChannelsTest.kt index 5c2cfe22..6a1a8539 100644 --- a/android/app/src/test/java/tv/orbit/classic/NewFilmChannelsTest.kt +++ b/android/app/src/test/java/tv/orbit/classic/NewFilmChannelsTest.kt @@ -26,7 +26,11 @@ class NewFilmChannelsTest { @Test fun storiesRunInOrderWithTiersAndMatureShowsLate() { val s = ch(STORIES_NUMBER) - assertEquals(48, StoriesShows.size) + // 48, and the teen strand's wave 1 (30 November 2026): six in After School from 16:00, two from 20:00. + assertEquals(56, StoriesShows.size) + listOf("Waterloo Road", "Glee", "Felicity").forEach { assertTrue(it, it in part(STORIES_NUMBER, 16).titles) } + listOf("Riverdale", "Pretty Little Liars").forEach { t -> assertTrue(t in part(STORIES_NUMBER, 20).titles); (6 until 20).forEach { h -> assertFalse("$t at $h", t in part(STORIES_NUMBER, h).titles) } } + listOf("13 Reasons Why", "XO, Kitty").forEach { assertFalse(it, it in StoriesShows) } assertTrue(s.storyGrouping); assertTrue(s.shuffleTitles.isEmpty()) assertEquals(TIER_SUPPORTING, StoriesTiers[seriesKey("Casualty")]); assertEquals(TIER_CORE, StoriesTiers[seriesKey("ER")]) listOf("Skins", "Shameless", "Euphoria (US)", "Sex Education").forEach { m -> diff --git a/android/app/src/test/java/tv/orbit/classic/StoriesTeenSimulationTest.kt b/android/app/src/test/java/tv/orbit/classic/StoriesTeenSimulationTest.kt index f634d614..61386a7e 100644 --- a/android/app/src/test/java/tv/orbit/classic/StoriesTeenSimulationTest.kt +++ b/android/app/src/test/java/tv/orbit/classic/StoriesTeenSimulationTest.kt @@ -13,7 +13,7 @@ import java.time.ZoneId * changes Stories: the proposed blocks live in this test. From a TV snapshot's own Stories pool and plan (its bookings kept as * they are), topped up daily for five weeks with the candidates added (their real season and episode counts, 43 minutes an * episode; a series stops before its first unplayable episode), against the other channels' plans. Compared with the same five - * weeks as Stories is now. Env: SIM_SNAP, SIM_TEEN (candidates.json), SIM_OUT. + * weeks with wave 1 only (as Stories now is, since 30 November 2026). Env: SIM_SNAP, SIM_TEEN (candidates.json), SIM_OUT. */ class StoriesTeenSimulationTest { private val afterSchoolNew = listOf("The Secret Life of the American Teenager", "Glee", "90210", "Switched at Birth", "Felicity", "Roswell", "Popular", @@ -21,6 +21,8 @@ class StoriesTeenSimulationTest { "The Runarounds", "Waterloo Road") private val primetimeNew = listOf("Riverdale", "Pretty Little Liars", "On My Block", "Ginny & Georgia", "My Mad Fat Diary") private val lateNew = listOf("Outer Banks", "Atypical", "Misfits", "The Wilds", "I Am Not Okay With This") + /** Wave 1 (Paul, 30 November 2026): the eight longest. */ + private val wave1 = setOf("Waterloo Road", "Pretty Little Liars", "Riverdale", "The Secret Life of the American Teenager", "Glee", "90210", "Switched at Birth", "Felicity") /** Where the playable run ends, by season and episode: the series stops before its first unplayable episode. */ private val stopAfter = mapOf("Never Have I Ever" to (2 to 7), "Love, Victor" to (2 to 99)) @@ -44,7 +46,7 @@ class StoriesTeenSimulationTest { } val everyday = p.dayParts.filter { it.days.isEmpty() } val events = p.dayParts.filter { it.days.isNotEmpty() } - fun titles(from: Int) = everyday.first { it.fromHour == from }.titles + fun titles(at: Int) = everyday.first { it.covers(at) }.titles.filter { it !in wave1 } val proposed = events + listOf( DayPart(6, 12, titles(6)), DayPart(12, 16, titles(12)), DayPart(16, 20, titles(17) + afterSchoolNew), DayPart(20, 23, titles(20) + primetimeNew), DayPart(23, 2, titles(23) + lateNew, key = "stories.afterhours"), DayPart(2, 6, titles(20) + titles(23) + primetimeNew + lateNew)) @@ -78,8 +80,12 @@ class StoriesTeenSimulationTest { val clashes = fresh.count { e -> clash(pool.first { it.id == e.seriesId }, e.startMs, e.endMs) } val gaps = fresh.zipWithNext().sumOf { (a, b) -> maxOf(0L, b.startMs - a.endMs) } / 60_000 // Episodes of each show in order, with nothing skipped. - val order = fresh.groupBy { it.seriesId }.count { (_, l) -> l.zipWithNext().any { (a, b) -> - val ea = a.mark; val eb = b.mark; !(eb.season == ea.season && eb.episode == ea.episode + 1) && !(eb.season > ea.season && eb.episode == 1) } } + val order = fresh.groupBy { it.seriesId }.count { (id, l) -> val eps = pool.first { it.id == id }.episodes.map { it.mark } + l.zipWithNext().any { (a, b) -> val i = eps.indexOf(a.mark); i < 0 || eps[(i + 1) % eps.size] != b.mark } } + // The same episode twice within a week. + val repeats = fresh.groupBy { "${it.seriesId}/${it.mark.season}/${it.mark.episode}" }.count { (_, l) -> l.zipWithNext().any { (a, b) -> b.startMs - a.startMs < 7 * 86_400_000L } } + fun strandHours(titles: List) = titles.map(::seriesKey).toSet().let { k -> fresh.filter { e -> seriesKey(pool.first { it.id == e.seriesId }.title) in k }.sumOf { it.endMs - it.startMs } / 3_600_000 } + val strands = mapOf("Mornings" to titles(6), "Wards" to titles(12), "Primetime" to titles(20), "Late" to titles(23)).mapValues { strandHours(it.value) } val hours = fresh.sumOf { it.endMs - it.startMs } / 3_600_000 val newHours = fresh.filter(isNew).sumOf { it.endMs - it.startMs } / 3_600_000 val teenExisting = titles(17).map(::seriesKey).toSet() @@ -87,14 +93,17 @@ class StoriesTeenSimulationTest { val byBlock = fresh.groupBy { local(it.startMs).hour.let { h -> when (h) { in 6..11 -> "06-12"; in 12..15 -> "12-16"; in 16..19 -> "16-20"; in 20..22 -> "20-23"; in 23..23, in 0..1 -> "23-02"; else -> "02-06" } } } .mapValues { (_, l) -> l.count(isNew) to l.size } report.append("$label: ${fresh.size} new programmes ($hours h) over 35 days; existing bookings kept $kept; new series $newHours h; Stories' own teen dramas $teenHours h; " + - "mature before 23:00 $matureEarly; clashes $clashes; gaps $gaps min; series out of order $order; new/all by block $byBlock\n") + "mature before 23:00 $matureEarly; clashes $clashes; gaps $gaps min; series out of order $order; repeats within a week $repeats; other strands $strands; new/all by block $byBlock\n") return fresh } - run("now", existingPool, p.dayParts) + run("wave1-as-built", existingPool + added.filter { it.title in wave1 }, p.dayParts) + val w1 = added.filter { it.title in wave1 } + fun keep(list: List) = list.filter { it in wave1 } + val wave1Parts = events + listOf( + DayPart(6, 12, titles(6)), DayPart(12, 16, titles(12)), DayPart(16, 20, titles(17) + keep(afterSchoolNew)), DayPart(20, 23, titles(20) + keep(primetimeNew)), + DayPart(23, 2, titles(23) + keep(lateNew), key = "stories.afterhours"), DayPart(2, 6, titles(20) + titles(23) + keep(primetimeNew) + keep(lateNew))) + run("wave1", existingPool + w1, wave1Parts) run("proposed", existingPool + added, proposed) - // The newcomers as supporting, so Stories' own series keep more of their airtime. - val newKeys = added.map { seriesKey(it.title) }.toSet() - run("proposed-supporting", existingPool + added, proposed) { show -> if (seriesKey(show.title) in newKeys) TIER_SUPPORTING else p.weightOf(show) } File(out, "summary.txt").writeText(report.toString()); println(report) assertTrue(report.toString(), report.lines().filter { it.isNotBlank() }.all { "kept true" in it && "mature before 23:00 0;" in it && "clashes 0;" in it }) }