From 7d7850ba3cad103aecfdb644be12247ac8e49512 Mon Sep 17 00:00:00 2001 From: Pauljd Date: Mon, 30 Nov 2026 20:59:57 +0000 Subject: [PATCH] Heroes Live (115): live-action superhero channel, blocks by type and identity Paul, 30 November 2026 (approved build plan): 65 series and 180 films from the audit, classics in the morning, contemporary from 12:00, a 21:00 feature, mature series from 23:00 and a late film at 01:00, films mixed across eras. Guests (Premiere's superhero films, Blade, Dredd, The Batman) only when rested five days on their own channel. Typed day parts: a series matches by its library identity, a film by IMDb ID, so a film and a series sharing a name never stand in for each other (the 06:00 anomaly). Serials with gaps stop before them (episodeRuns). Lois & Clark held. Not releasable yet: no logo, palette or idents until Paul chooses the look (three branding tests fail on purpose until then). Existing channels' matching is unchanged. Co-Authored-By: Claude Opus 5.5 --- .../java/tv/orbit/classic/ChannelPresets.kt | 1 + .../java/tv/orbit/classic/ChannelSchedule.kt | 43 +- .../java/tv/orbit/classic/ChannelScheduler.kt | 4 +- .../java/tv/orbit/classic/FilmIdentity.kt | 4 +- .../main/java/tv/orbit/classic/HeroesLive.kt | 396 ++++++++++++++++++ .../tv/orbit/classic/ChannelPresetsTest.kt | 4 +- .../classic/HeroesLiveBuildSimulationTest.kt | 77 ++++ .../tv/orbit/classic/HeroesLiveChannelTest.kt | 63 +++ .../java/tv/orbit/classic/PpvSundayTest.kt | 2 +- 9 files changed, 579 insertions(+), 15 deletions(-) create mode 100644 android/app/src/main/java/tv/orbit/classic/HeroesLive.kt create mode 100644 android/app/src/test/java/tv/orbit/classic/HeroesLiveBuildSimulationTest.kt create mode 100644 android/app/src/test/java/tv/orbit/classic/HeroesLiveChannelTest.kt diff --git a/android/app/src/main/java/tv/orbit/classic/ChannelPresets.kt b/android/app/src/main/java/tv/orbit/classic/ChannelPresets.kt index a894cf29..04e42684 100644 --- a/android/app/src/main/java/tv/orbit/classic/ChannelPresets.kt +++ b/android/app/src/main/java/tv/orbit/classic/ChannelPresets.kt @@ -59,6 +59,7 @@ internal val ChannelPresets = listOf( ChannelPreset(ATLAS_NUMBER, "ATLAS", AtlasShows, smartOnly = true), ChannelPreset(SYNDICATE_NUMBER, "SYNDICATE", SyndicateShows, smartOnly = true), ChannelPreset(WONDER_TV_NUMBER, "Wonder TV", WonderTvShows, smartOnly = true), + ChannelPreset(HEROES_LIVE_NUMBER, "Heroes Live", HeroesLiveShows, smartOnly = true), ChannelPreset(PUNCHLINE_NUMBER, "PUNCHLINE", PunchlineFilms, smartOnly = true, films = true), ChannelPreset(CHRISTMAS_NUMBER, "Orbit Christmas", ChristmasFilms, smartOnly = true, films = true), ChannelPreset(206, "Orbit Home", HomeShows, smartOnly = true), diff --git a/android/app/src/main/java/tv/orbit/classic/ChannelSchedule.kt b/android/app/src/main/java/tv/orbit/classic/ChannelSchedule.kt index b4eca5cd..a7891c4e 100644 --- a/android/app/src/main/java/tv/orbit/classic/ChannelSchedule.kt +++ b/android/app/src/main/java/tv/orbit/classic/ChannelSchedule.kt @@ -46,7 +46,24 @@ internal data class DayPart(val fromHour: Int, val toHour: Int, val titles: List */ val monthWeek: Int? = null, /** Only in these months, counted by the night it starts; empty is every month (PUNCHLINE's Star of the Month, 25 November 2026). */ - val months: Set = emptySet()) { + val months: Set = emptySet(), + /** + * Names by type (Heroes Live, 30 November 2026): a plain title only ever means a series, and a film only ever matches by its + * own identity ([FilmIdentity], IMDb ID where it has one), so a film and a series sharing a name never stand in for each other. + */ + val typed: Boolean = false, + /** With [typed]: a series' library identities (such as "tvdb.76168"); a pool series with a different one isn't that series. */ + val seriesRefs: Map> = emptyMap(), + /** With [typed]: which of [titles] are films; every other entry is a series, even one written like a film ("Batman (1966)"). */ + val filmEntries: Set = emptySet()) { + private val typedSeries by lazy { titles.filter { it !in filmEntries }.map(::seriesKey).toSet() } + private val typedFilms by lazy { titles.filter { it in filmEntries }.map(FilmIdentity::of) } + /** Whether [show] is one this block names, by type when [typed]. */ + fun names(show: PoolSeries, titles: Set, films: List): Boolean = + if (!typed) seriesKey(show.title) in titles || (show.isFilm && films.any { f -> f.names(show) }) + else if (show.isFilm) typedFilms.any { f -> f.imdb != null && f.names(show) } + else seriesKey(show.title) in typedSeries && seriesRefs.entries.firstOrNull { seriesKey(it.key) == seriesKey(show.title) }?.value + ?.let { refs -> show.ref.isEmpty() || show.ref in refs } != false fun covers(hour: Int) = if (fromHour <= toHour) hour in fromHour until toHour else hour >= fromHour || hour < toHour /** An event that runs past midnight belongs to the night it started, so its small hours count from the day before. */ fun covers(hour: Int, day: java.time.DayOfWeek) = covers(hour) && (days.isEmpty() || (if (fromHour > toHour && hour < toHour) day.minus(1) else day) in days) @@ -119,7 +136,9 @@ internal data class ChannelProgramming(val number: Int, val name: String, val se /** Shorts grouping (Paul, 6 November 2026): short episodes gathered into slots of about half an hour. Null for none. */ val shorts: ShortsRule? = null, /** Marathon (Create your own): this many episodes of a show back to back before the next takes over; 0 for none. */ - val marathon: Int = 0) { + val marathon: Int = 0, + /** Serials with a gap in the library: each plays only up to this episode, so its story never jumps (Heroes Live, 30 November 2026). */ + val episodeRuns: Map = emptyMap()) { /** The items taken off this channel on the server signed in to: [withdrawnOnOriginal] there, none anywhere else. */ val withdrawn: Set get() = if (Workspaces.paulsServerOpen) withdrawnOnOriginal else emptySet() /** A show's weight here, by its tier (a show the brief doesn't name counts as supporting), scaled by [catalogueScaleHours]. */ @@ -285,9 +304,10 @@ internal val BuiltInChannels = listOf( // ATLAS (24 November 2026) plays international programmes in their own language: no English-sound filter; its own // rule ([AtlasPlayback]) is applied as its pools are read instead. englishAudio = it.number != ATLAS_NUMBER, - channelFilms = if (it.number == 401) PpvSunday else if (it.number == ATLAS_NUMBER) AtlasFilms else if (it.number == SYNDICATE_NUMBER) SyndicateFilms else if (it.number == WONDER_TV_NUMBER) WonderTvFilms else emptyList(), tierWeights = SmartChannelTiers[it.number], adaptiveFilmRest = it.number in AdaptiveFilmRestChannels, + channelFilms = if (it.number == 401) PpvSunday else if (it.number == ATLAS_NUMBER) AtlasFilms else if (it.number == SYNDICATE_NUMBER) SyndicateFilms else if (it.number == WONDER_TV_NUMBER) WonderTvFilms else if (it.number == HEROES_LIVE_NUMBER) HeroesLiveFilms else emptyList(), tierWeights = SmartChannelTiers[it.number], adaptiveFilmRest = it.number in AdaptiveFilmRestChannels, // SYNDICATE (25 November 2026) books films every day, so each rests five days, as across the network. - fileRestMs = if (it.number == SYNDICATE_NUMBER) NETWORK_FILM_REST_MS else if (it.number == WONDER_TV_NUMBER) WONDER_TV_FILM_REST_MS else SAME_FILE_MS, + fileRestMs = if (it.number == SYNDICATE_NUMBER || it.number == HEROES_LIVE_NUMBER) NETWORK_FILM_REST_MS else if (it.number == WONDER_TV_NUMBER) WONDER_TV_FILM_REST_MS else SAME_FILE_MS, + episodeRuns = if (it.number == HEROES_LIVE_NUMBER) HeroesLiveRuns else emptyMap(), catalogueScaleHours = if (it.number in CatalogueScaledChannels) CATALOGUE_SCALE_HOURS else null, catalogueScaleFloor = CatalogueScaleFloors[it.number] ?: MIN_CATALOGUE_SCALE, storyGrouping = it.number in StoryGroupingChannels, shorts = if (it.number == 605) ToonZShorts else null) } @@ -298,7 +318,7 @@ internal val BuiltInChannels = listOf( * other series channel since 5 November 2026 (Paul: part ones first, everywhere): weighted blocks book a story whole, and a * mixed show in equal turns keeps it whole and in order in its deck. */ -private val StoryGroupingChannels get() = setOf(101, 102, 103, 104, 105, 107, 108, 109, 110, AMERICANA_NUMBER, STORIES_NUMBER, ATLAS_NUMBER, SYNDICATE_NUMBER, WONDER_TV_NUMBER, 202, 203, 204, 205, 206, 401, 602, 603, 604, 605, 611) +private val StoryGroupingChannels get() = setOf(101, 102, 103, 104, 105, 107, 108, 109, 110, AMERICANA_NUMBER, STORIES_NUMBER, ATLAS_NUMBER, SYNDICATE_NUMBER, WONDER_TV_NUMBER, HEROES_LIVE_NUMBER, 202, 203, 204, 205, 206, 401, 602, 603, 604, 605, 611) /** * Where a short series must keep at least half its tier's weight, so the hybrid trims its weekly repeats without cutting its @@ -330,7 +350,7 @@ private val SmartChannelMixed: Map> get() = mapOf(101 to Orbit1 private val SmartChannelParts: Map> get() = mapOf(101 to Orbit1DayParts, 102 to Orbit2DayParts, 103 to ThreeDayParts, 104 to GoldDayParts, 105 to RiotDayParts, 304 to HorrorDayParts, 602 to HeroesDayParts, 603 to OrbitXDayParts, 604 to RewindDayParts, 605 to ToonZDayParts, 204 to DarkFilesDayParts, 203 to WildDayParts, 202 to OdysseyDayParts, 107 to EvidenceDayParts, 401 to RingXDayParts, 611 to JuniorDayParts, 205 to KitchenDayParts, 206 to HomeDayParts, 108 to PlayDayParts, - 109 to SignatureDayParts, 110 to UnscriptedDayParts, CHRISTMAS_NUMBER to ChristmasDayParts, AMERICANA_NUMBER to AmericanaDayParts, ATLAS_NUMBER to AtlasDayParts, SYNDICATE_NUMBER to SyndicateDayParts, PUNCHLINE_NUMBER to PunchlineDayParts, WONDER_NUMBER to WonderDayParts, WONDER_TV_NUMBER to WonderTvDayParts, OUTLAW_NUMBER to OutlawDayParts, SILVER_SCREEN_NUMBER to SilverScreenDayParts, STORIES_NUMBER to StoriesDayParts) + 109 to SignatureDayParts, 110 to UnscriptedDayParts, CHRISTMAS_NUMBER to ChristmasDayParts, AMERICANA_NUMBER to AmericanaDayParts, ATLAS_NUMBER to AtlasDayParts, SYNDICATE_NUMBER to SyndicateDayParts, PUNCHLINE_NUMBER to PunchlineDayParts, WONDER_NUMBER to WonderDayParts, WONDER_TV_NUMBER to WonderTvDayParts, HEROES_LIVE_NUMBER to HeroesLiveDayParts, OUTLAW_NUMBER to OutlawDayParts, SILVER_SCREEN_NUMBER to SilverScreenDayParts, STORIES_NUMBER to StoriesDayParts) /** Optional bigger pools, only used once reviewed. No rule for Orbit Gold or Orbit Three: nothing in the library's details can tell a British sitcom apart. */ private val SmartChannelRules: Map> get() = mapOf( @@ -471,7 +491,7 @@ internal fun dayPartFor(pool: List, parts: List, startMs: L // or with the year in its name, as the VPS names its events ("AEW All Out 2019" for "AEW All Out (2019)"). val films = part.titles.map(FilmIdentity::of) val open = openJoins(part, parts) - pool.filter { seriesKey(it.title) in titles || (it.isFilm && films.any { f -> f.names(it) }) || inGroup(it, part.group) || (open && it.group == OPEN_GROUP) } + pool.filter { part.names(it, titles, films) || inGroup(it, part.group) || (open && it.group == OPEN_GROUP) } } if (allowed.isNotEmpty()) return Triple(allowed, name, part) } @@ -479,6 +499,13 @@ internal fun dayPartFor(pool: List, parts: List, startMs: L return Triple(pool.filter { !it.isFilm || pool.all(PoolSeries::isFilm) }.ifEmpty { pool }, if (parts.isEmpty()) "whole pool" else "no block, whole pool", null) } +/** [series] with each serial in [runs] ending at its last playable episode before a gap. */ +internal fun withinRuns(series: List, runs: Map): List = if (runs.isEmpty()) series else { + val byKey = runs.mapKeys { seriesKey(it.key) } + series.mapNotNull { s -> val last = byKey[seriesKey(s.title)] ?: return@mapNotNull s + s.copy(episodes = s.episodes.filter { e -> e.mark.season < last.season || (e.mark.season == last.season && e.mark.episode <= last.episode) }).takeIf { it.episodes.isNotEmpty() } } +} + /** A few names and how many more, so a reason stays short. */ private fun someOf(names: List) = names.take(3).joinToString(", ") + if (names.size > 3) " +${names.size - 3}" else "" @@ -717,7 +744,7 @@ internal fun filmsIn(pool: List, part: DayPart): List { if (part.titles.isEmpty() && part.group.isEmpty()) return pool.filter { it.isFilm } val titles = part.titles.map(::seriesKey).toSet() val films = part.titles.map(FilmIdentity::of) - return pool.filter { it.isFilm && (seriesKey(it.title) in titles || films.any { f -> f.names(it) } || inGroup(it, part.group)) } + return pool.filter { it.isFilm && (part.names(it, titles, films) || inGroup(it, part.group)) } } /** diff --git a/android/app/src/main/java/tv/orbit/classic/ChannelScheduler.kt b/android/app/src/main/java/tv/orbit/classic/ChannelScheduler.kt index 8abc3d34..1a7d4226 100644 --- a/android/app/src/main/java/tv/orbit/classic/ChannelScheduler.kt +++ b/android/app/src/main/java/tv/orbit/classic/ChannelScheduler.kt @@ -624,10 +624,10 @@ internal class ChannelScheduler(private val store: ScheduleStore, // Under the plan lock, so a programme being re-timed for its real length (PlanEdits) is never written over. val (existing, plan) = synchronized(PlanEdits.lock) { val existing = store.loadPlan(userId, number) - val plan = topUpPlan(existing, base, pool?.series?.let { withOpenApprovals(withoutOddRuntimes(withoutFailed(it, store.loadFailed(userId)), number, store.runtimeReleases().load()), choices) }?.let { if (programming.mixedTurns) mixedTurnOrder(it, number) else it }, now, programming.filmRestMs, programming.finishTogether, programming.dayParts, + val plan = topUpPlan(existing, base, pool?.series?.let { withOpenApprovals(withoutOddRuntimes(withoutFailed(withinRuns(it, programming.episodeRuns), store.loadFailed(userId)), number, store.runtimeReleases().load()), choices) }?.let { if (programming.mixedTurns) mixedTurnOrder(it, number) else it }, now, programming.filmRestMs, programming.finishTogether, programming.dayParts, // SYNDICATE, a series channel that books films every day, also rests a film another channel shows within five days // (25 November 2026), as the film channels do: a preference, given up only when nothing else fits, like a clash. - avoid = { show, startMs, endMs -> others(show, startMs, endMs) || ((number == SYNDICATE_NUMBER || number == WONDER_TV_NUMBER) && show.isFilm && restingElsewhere(show, startMs)) }, + avoid = { show, startMs, endMs -> others(show, startMs, endMs) || ((number == SYNDICATE_NUMBER || number == WONDER_TV_NUMBER || number == HEROES_LIVE_NUMBER) && show.isFilm && restingElsewhere(show, startMs)) }, shuffle = programming.shuffleEpisodes, mixed = programming::mixes, weightOf = programming.tierWeights?.let { programming::weightOf }, adaptiveRest = programming.adaptiveFilmRest, fileRestMs = programming.fileRestMs, stories = programming.storyGrouping, shorts = programming.shorts, marathon = programming.marathon, seasonEndMs = seasonEndMs(number, now), network = network) ?: throw EmbyCheckException("${programming.name} has no episodes to schedule.") diff --git a/android/app/src/main/java/tv/orbit/classic/FilmIdentity.kt b/android/app/src/main/java/tv/orbit/classic/FilmIdentity.kt index 908c01e4..a7f9d28d 100644 --- a/android/app/src/main/java/tv/orbit/classic/FilmIdentity.kt +++ b/android/app/src/main/java/tv/orbit/classic/FilmIdentity.kt @@ -14,8 +14,8 @@ internal data class FilmIdentity(val title: String, val year: Int? = null, val i private val withYear = Regex("""^(.*\S)\s+\((\d{4})\)$""") fun of(entry: String): FilmIdentity { val trimmed = entry.trim() - val match = withYear.matchEntire(trimmed) ?: return FilmIdentity(trimmed, imdb = FilmImdb[trimmed] ?: OutlawImdb[trimmed] ?: NewChannelImdb[trimmed] ?: AtlasImdb[trimmed] ?: PunchlineImdb[trimmed] ?: SyndicateImdb[trimmed] ?: WonderImdb[trimmed] ?: WonderTvImdb[trimmed]) - return FilmIdentity(match.groupValues[1], match.groupValues[2].toInt(), FilmImdb[trimmed] ?: OutlawImdb[trimmed] ?: NewChannelImdb[trimmed] ?: AtlasImdb[trimmed] ?: PunchlineImdb[trimmed] ?: SyndicateImdb[trimmed] ?: WonderImdb[trimmed] ?: WonderTvImdb[trimmed]) + val match = withYear.matchEntire(trimmed) ?: return FilmIdentity(trimmed, imdb = FilmImdb[trimmed] ?: OutlawImdb[trimmed] ?: NewChannelImdb[trimmed] ?: AtlasImdb[trimmed] ?: PunchlineImdb[trimmed] ?: SyndicateImdb[trimmed] ?: WonderImdb[trimmed] ?: WonderTvImdb[trimmed] ?: HeroesLiveImdb[trimmed]) + return FilmIdentity(match.groupValues[1], match.groupValues[2].toInt(), FilmImdb[trimmed] ?: OutlawImdb[trimmed] ?: NewChannelImdb[trimmed] ?: AtlasImdb[trimmed] ?: PunchlineImdb[trimmed] ?: SyndicateImdb[trimmed] ?: WonderImdb[trimmed] ?: WonderTvImdb[trimmed] ?: HeroesLiveImdb[trimmed]) } } } diff --git a/android/app/src/main/java/tv/orbit/classic/HeroesLive.kt b/android/app/src/main/java/tv/orbit/classic/HeroesLive.kt new file mode 100644 index 00000000..4aed53f0 --- /dev/null +++ b/android/app/src/main/java/tv/orbit/classic/HeroesLive.kt @@ -0,0 +1,396 @@ +package tv.orbit.classic + +/** + * Heroes Live (115): live-action superhero television and films, the counterpart to Orbit Heroes' cartoons (Paul, 30 November + * 2026: approved for build planning, then building; read-only audit, five-week simulations and a switch-on check first). + * Series-led: classic superhero television in the morning, contemporary shows from 12:00, a feature at 21:00, mature series + * from 23:00 and a late film at 01:00. Films are mixed across eras (newest, oldest and middle in turn). Premiere's superhero + * films, Blade and Dredd (Orbit Action) and The Batman (SYNDICATE) stay those channels' own: here they are guests, shown only + * when rested five days either side on their own channel. Lois & Clark is held until its pilot is in the library; the + * serials with gaps (Gotham, Naomi, The Flash 1990, The Gifted, the 1948 Superman serial) are left out, and Arrow, Legends of + * Tomorrow and Runaways stop before their first missing episode. + * + * Every block names its programmes by type (Paul, 30 November 2026): a series by its library identity, a film by IMDb ID, + * so a film and a series that share a name (Batman (1966)) can never stand in for each other. + */ +internal const val HEROES_LIVE_NUMBER = 115 + +/** Morning: classic superhero television. */ +private val HeroesLiveClassics = listOf( + "Adventures of Superman", "The Adventures of Superboy (1988)", "The Incredible Hulk", "Wonder Woman", + "The Greatest American Hero", "Batman (1966)", "M.A.N.T.I.S.", "Mutant X", + "The Cape (2011)") + +/** Afternoon and evening: contemporary and mainstream superhero series. */ +private val HeroesLiveContemporary = listOf( + "The Flash (2014)", "Arrow", "Supergirl", "DC's Legends of Tomorrow", + "Superman & Lois", "Batwoman", "Marvel's Agents of S.H.I.E.L.D.", "Marvel's Agent Carter", + "Heroes", "Heroes Reborn", "The Umbrella Academy", "Loki", + "WandaVision", "Hawkeye (2021)", "Ms. Marvel", "Moon Knight", + "The Falcon and The Winter Soldier", "She-Hulk: Attorney at Law", "Secret Invasion", "Agatha All Along", + "Ironheart", "VisionQuest", "The Tick (2017)", "Raising Dion", + "Krypton", "Marvel's Runaways", "Marvel's Cloak & Dagger", "Marvel's Inhumans", + "Legion", "Powerless", "Constantine", "Birds of Prey", + "Gotham Knights", "Painkiller Jane", "The Crow: Stairway to Heaven") + +/** From 23:00: mature superhero series. */ +private val HeroesLiveMature = listOf( + "Marvel's Daredevil", "Marvel's Jessica Jones", "Marvel's The Punisher", "Marvel's Luke Cage", + "Marvel's Iron Fist", "Marvel's The Defenders", "Daredevil: Born Again", "The Boys", + "Gen V", "Doom Patrol", "Peacemaker", "Watchmen", + "Misfits", "Jupiter's Legacy", "Supacell", "Swamp Thing (2019)", + "Helstrom", "Echo", "Spider-Noir", "Lanterns", + "Blade") + +internal val HeroesLiveShows get() = HeroesLiveClassics + HeroesLiveContemporary + HeroesLiveMature + +/** The 21:00 feature: PG to PG-13 films, mixed across eras. */ +private val HeroesLiveFeatures = listOf( + "Spider-Man: Brand New Day (2026)", "Batman (1966)", "Elektra (2005)", + "Supergirl (2026)", "The Incredible Hulk (1977)", "Batman Begins (2005)", + "The Fantastic Four: First Steps (2025)", "Superman (1978)", "Fantastic Four (2005)", + "Superman (2025)", "Captain America (1979)", "Sky High (2005)", + "Thunderbolts*: *The New Avengers (2025)", "Captain America II: Death Too Soon (1979)", "Painkiller Jane (2005)", + "Captain America: Brave New World (2025)", "Superman II (1980)", "X-Men: The Last Stand (2006)", + "Venom: The Last Dance (2024)", "Spider-Man: The Dragon's Challenge (1981)", "Superman Returns (2006)", + "Madame Web (2024)", "Condorman (1981)", "My Super Ex-Girlfriend (2006)", + "Aquaman and the Lost Kingdom (2023)", "Swamp Thing (1982)", "Zoom (2006)", + "The Marvels (2023)", "Superman III (1983)", "Superman II: The Richard Donner Cut (2006)", + "Blue Beetle (2023)", "Supergirl (1984)", "Ghost Rider (2007)", + "The Flash (2023)", "Superman IV: The Quest for Peace (1987)", "Spider-Man 3 (2007)", + "Guardians of the Galaxy Vol. 3 (2023)", "The Incredible Hulk Returns (1988)", "Fantastic Four: Rise of the Silver Surfer (2007)", + "Shazam! Fury of the Gods (2023)", "Bionic Showdown: The Six Million Dollar Man and the Bionic Woman (1989)", "Black Lightning (2008)", + "Ant-Man and the Wasp: Quantumania (2023)", "The Return of Swamp Thing (1989)", "Iron Man (2008)", + "Black Panther: Wakanda Forever (2022)", "Batman (1989)", "The Incredible Hulk (2008)", + "Black Adam (2022)", "The Trial of the Incredible Hulk (1989)", "Hellboy II: The Golden Army (2008)", + "Thor: Love and Thunder (2022)", "Captain America (1990)", "The Dark Knight (2008)", + "Doctor Strange in the Multiverse of Madness (2022)", "The Flash (1990)", "The Spirit (2008)", + "Morbius (2022)", "The Death of the Incredible Hulk (1990)", "X-Men Origins: Wolverine (2009)", + "The Batman (2022)", "The Rocketeer (1991)", "Iron Man 2 (2010)", + "Spider-Man: No Way Home (2021)", "Batman Returns (1992)", "Jonah Hex (2010)", + "Eternals (2021)", "The Meteor Man (1993)", "Thor (2011)", + "Venom: Let There Be Carnage (2021)", "The Shadow (1994)", "X-Men: First Class (2011)", + "Shang-Chi and the Legend of the Ten Rings (2021)", "Blankman (1994)", "Green Lantern (2011)", + "Black Widow (2021)", "M.A.N.T.I.S. (1994)", "Captain America: The First Avenger (2011)", + "Thunder Force (2021)", "Batman Forever (1995)", "Ghost Rider: Spirit of Vengeance (2011)", + "Wonder Woman 1984 (2020)", "The Phantom (1996)", "Chronicle (2012)", + "The New Mutants (2020)", "Generation X (1996)", "The Avengers (2012)", + "Spider-Man: Far from Home (2019)", "Batman & Robin (1997)", "The Amazing Spider-Man (2012)", + "X-Men: Dark Phoenix (2019)", "Spawn (1997)", "The Dark Knight Rises (2012)", + "Avengers: Endgame (2019)", "Steel (1997)", "Iron Man 3 (2013)", + "Shazam! (2019)", "The Avengers (1998)", "Man of Steel (2013)", + "Captain Marvel (2019)", "Nick Fury: Agent of S.H.I.E.L.D. (1998)", "The Wolverine (2013)", + "Glass (2019)", "Mystery Men (1999)", "Thor: The Dark World (2013)", + "Once Upon a Deadpool (2018)", "X-Men (2000)", "Captain America: The Winter Soldier (2014)", + "Aquaman (2018)", "Unbreakable (2000)", "The Amazing Spider-Man 2 (2014)", + "Venom (2018)", "Witchblade (2000)", "X-Men: Days of Future Past (2014)", + "Ant-Man and the Wasp (2018)", "Spider-Man (2002)", "Guardians of the Galaxy (2014)", + "Avengers: Infinity War (2018)", "Daredevil (2003)", "Avengers: Age of Ultron (2015)", + "Black Panther (2018)", "X2: X-Men United (2003)", "Ant-Man (2015)", + "Justice League (2017)", "Hulk (2003)", "Fantastic Four (2015)", + "Thor: Ragnarok (2017)", "Hellboy (2004)", "Captain America: Civil War (2016)", + "Spider-Man: Homecoming (2017)", "Spider-Man 2 (2004)", "X-Men: Apocalypse (2016)", + "Wonder Woman (2017)", "Catwoman (2004)", "Suicide Squad (2016)", + "Guardians of the Galaxy Vol. 2 (2017)", "Doctor Strange (2016)") + +/** The 01:00 late film: R-rated films, mixed across eras. */ +private val HeroesLiveLateFilms = listOf( + "The Old Guard 2 (2025)", "The Punisher (1989)", "Constantine (2005)", + "Kraven the Hunter (2024)", "Darkman (1990)", "Man-Thing (2005)", + "Hellboy: The Crooked Man (2024)", "The Crow (1994)", "The Crow: Wicked Prayer (2005)", + "The Crow (2024)", "Judge Dredd (1995)", "Hancock (2008)", + "Deadpool & Wolverine (2024)", "Black Scorpion (1995)", "Punisher: War Zone (2008)", + "Zack Snyder's Justice League (2021)", "Darkman II: The Return of Durant (1995)", "Watchmen (2009)", + "The Suicide Squad (2021)", "Darkman III: Die Darkman Die (1996)", "Defendor (2009)", + "Project Power (2020)", "The Crow: City of Angels (1996)", "Kick-Ass (2010)", + "The Old Guard (2020)", "Black Scorpion II: Aftershock (1997)", "Super (2010)", + "Birds of Prey and the Fantabulous Emancipation of One Harley Quinn (2020)", "Blade (1998)", "Dredd (2012)", + "Joker (2019)", "The Crow: Salvation (2000)", "Kick-Ass 2 (2013)", + "Freaks (2019)", "Blade II (2002)", "Deadpool (2016)", + "Brightburn (2019)", "The Punisher (2004)", "Batman v Superman: Dawn of Justice (2016)", + "Hellboy (2019)", "Blade: Trinity (2004)", "Logan (2017)", + "Deadpool 2 (2018)") + +internal val HeroesLiveFilms get() = HeroesLiveFeatures + HeroesLiveLateFilms + +/** Guests: other channels' films, shown here only when rested on their own channel ([NETWORK_FILM_REST_MS]). */ +internal val HeroesLiveGuests = setOf( + "Batman Begins (2005)", "Superman (1978)", "Spider-Man 3 (2007)", + "Iron Man (2008)", "Batman (1989)", "The Dark Knight (2008)", + "The Batman (2022)", "Spider-Man: No Way Home (2021)", "Batman Returns (1992)", + "X-Men: First Class (2011)", "The Avengers (2012)", "The Dark Knight Rises (2012)", + "Avengers: Endgame (2019)", "Man of Steel (2013)", "X-Men (2000)", + "Captain America: The Winter Soldier (2014)", "Aquaman (2018)", "X-Men: Days of Future Past (2014)", + "Spider-Man (2002)", "Guardians of the Galaxy (2014)", "Avengers: Infinity War (2018)", + "Avengers: Age of Ultron (2015)", "Black Panther (2018)", "Thor: Ragnarok (2017)", + "Captain America: Civil War (2016)", "Spider-Man: Homecoming (2017)", "Spider-Man 2 (2004)", + "Wonder Woman (2017)", "Guardians of the Galaxy Vol. 2 (2017)", "Doctor Strange (2016)", + "Blade (1998)", "Dredd (2012)", "Joker (2019)", + "Deadpool (2016)") + +/** Serials with a gap: where their playable run ends, by season and episode (the audit, 30 November 2026). */ +internal val HeroesLiveRuns: Map = mapOf("Arrow" to EpisodeMark(6, 3), "DC's Legends of Tomorrow" to EpisodeMark(5, 3), "Marvel's Runaways" to EpisodeMark(1, 10)) + +/** Each series' library identity (TVDB and IMDb IDs), so a series is matched by what it is, not only its name. */ +internal val HeroesLiveSeriesRefs: Map> by lazy { mapOf( + "Peacemaker" to setOf("imdb.tt0796142", "imdb.tt13146488", "tvdb.391153", "tvdb.74633"), + "Adventures of Superman" to setOf("imdb.tt0044231", "tvdb.77403"), + "Arrow" to setOf("imdb.tt2193021", "tvdb.257655"), + "Marvel's The Punisher" to setOf("imdb.tt5675620", "tvdb.331980"), + "Gen V" to setOf("imdb.tt13159924", "tvdb.417909"), + "The Adventures of Superboy (1988)" to setOf("imdb.tt0094559", "tvdb.76948"), + "Echo" to setOf("imdb.tt13966962", "tvdb.412431"), + "Ironheart" to setOf("imdb.tt13623126", "tvdb.393204"), + "The Boys" to setOf("imdb.tt1190634", "tvdb.355567"), + "Marvel's Jessica Jones" to setOf("imdb.tt2357547", "tvdb.284190"), + "Agatha All Along" to setOf("imdb.tt15571732", "tvdb.412429"), + "The Umbrella Academy" to setOf("imdb.tt1312171", "tvdb.353764"), + "Hawkeye (2021)" to setOf("imdb.tt10160804", "tvdb.367146"), + "Wonder Woman" to setOf("imdb.tt0074074", "tvdb.71228"), + "The Flash (2014)" to setOf("imdb.tt3107288", "tvdb.279121"), + "Superman & Lois" to setOf("imdb.tt11192306", "tvdb.375655"), + "Daredevil: Born Again" to setOf("imdb.tt18923754", "tvdb.422712"), + "Marvel's Cloak & Dagger" to setOf("imdb.tt5614844", "tvdb.341455"), + "Marvel's Inhumans" to setOf("imdb.tt4154858", "tvdb.320558"), + "Loki" to setOf("imdb.tt9140554", "tvdb.362472"), + "Secret Invasion" to setOf("imdb.tt13157618", "tvdb.393203"), + "She-Hulk: Attorney at Law" to setOf("imdb.tt10857160", "tvdb.368613"), + "Ms. Marvel" to setOf("imdb.tt10857164", "tvdb.368612"), + "Moon Knight" to setOf("imdb.tt10234724", "tvdb.368611"), + "The Falcon and The Winter Soldier" to setOf("imdb.tt9208876", "tvdb.362496"), + "WandaVision" to setOf("imdb.tt9140560", "tvdb.362392"), + "Helstrom" to setOf("tvdb.364038"), + "Marvel's Runaways" to setOf("imdb.tt1236246", "tvdb.332027"), + "Gotham Knights" to setOf("imdb.tt16418896", "tvdb.420061"), + "Doom Patrol" to setOf("imdb.tt8416494", "tvdb.355622"), + "The Tick (2017)" to setOf("imdb.tt5540054", "tvdb.317654"), + "Swamp Thing (2019)" to setOf("imdb.tt8362852", "tvdb.361735"), + "Raising Dion" to setOf("imdb.tt7826108", "tvdb.473968"), + "Legion" to setOf("imdb.tt5114356", "tvdb.320724"), + "Marvel's Iron Fist" to setOf("imdb.tt3322310", "tvdb.317953"), + "Powerless" to setOf("imdb.tt5083928", "tvdb.311786"), + "Supergirl" to setOf("imdb.tt4016454", "tvdb.295759"), + "Marvel's Agents of S.H.I.E.L.D." to setOf("imdb.tt2364582", "tvdb.263365"), + "Marvel's Luke Cage" to setOf("imdb.tt3322314", "tvdb.304219"), + "Marvel's Daredevil" to setOf("imdb.tt3322312", "tvdb.281662"), + "Heroes Reborn" to setOf("imdb.tt3556944", "tvdb.279201"), + "The Cape (2011)" to setOf("imdb.tt1593823", "tvdb.160671"), + "Misfits" to setOf("imdb.tt1548850", "tvdb.124051"), + "Heroes" to setOf("imdb.tt0813715", "tvdb.79501"), + "Watchmen" to setOf("imdb.tt7049682", "tvdb.360733"), + "Krypton" to setOf("imdb.tt4276624", "tvdb.328599"), + "Marvel's Agent Carter" to setOf("imdb.tt3475734", "tvdb.281485"), + "The Incredible Hulk" to setOf("imdb.tt0077031", "tvdb.71746"), + "Constantine" to setOf("imdb.tt3489184", "tvdb.273690"), + "Marvel's The Defenders" to setOf("imdb.tt4230076", "tvdb.326490"), + "The Greatest American Hero" to setOf("imdb.tt0081871", "tvdb.77267"), + "The Crow: Stairway to Heaven" to setOf("imdb.tt0166425", "tvdb.72850"), + "Jupiter's Legacy" to setOf("imdb.tt5774002", "tvdb.368388"), + "Mutant X" to setOf("imdb.tt0283203", "tvdb.76533"), + "DC's Legends of Tomorrow" to setOf("imdb.tt4532368", "tvdb.295760"), + "Batwoman" to setOf("imdb.tt8712204", "tvdb.361315"), + "Batman (1966)" to setOf("imdb.tt0059968", "tvdb.77871"), + "Supacell" to setOf("imdb.tt16283758", "tvdb.427116"), + "Painkiller Jane" to setOf("imdb.tt0866432", "tvdb.75546"), + "Spider-Noir" to setOf("imdb.tt30460310", "tvdb.450033"), + "M.A.N.T.I.S." to setOf("imdb.tt0108843", "tvdb.76517"), + "Blade" to setOf("imdb.tt0823333", "tvdb.73192"), + "Lanterns" to setOf("imdb.tt26545992", "tvdb.376098"), + "VisionQuest" to setOf("imdb.tt23112594", "tvdb.426606"), + "Birds of Prey" to setOf("imdb.tt0312098", "tvdb.77746")) } + +internal val HeroesLiveImdb: Map by lazy { mapOf( + "Spider-Man: Brand New Day (2026)" to "tt22084616", + "Batman (1966)" to "tt0060153", + "Elektra (2005)" to "tt0357277", + "Supergirl (2026)" to "tt8814476", + "The Incredible Hulk (1977)" to "tt0076190", + "Batman Begins (2005)" to "tt0372784", + "The Fantastic Four: First Steps (2025)" to "tt10676052", + "Superman (1978)" to "tt0078346", + "Fantastic Four (2005)" to "tt0120667", + "Superman (2025)" to "tt5950044", + "Captain America (1979)" to "tt0078937", + "Sky High (2005)" to "tt0405325", + "Thunderbolts*: *The New Avengers (2025)" to "tt20969586", + "Captain America II: Death Too Soon (1979)" to "tt0078938", + "Painkiller Jane (2005)" to "tt0466391", + "Captain America: Brave New World (2025)" to "tt14513804", + "Superman II (1980)" to "tt0081573", + "X-Men: The Last Stand (2006)" to "tt0376994", + "Venom: The Last Dance (2024)" to "tt16366836", + "Spider-Man: The Dragon's Challenge (1981)" to "tt0077328", + "Superman Returns (2006)" to "tt0348150", + "Madame Web (2024)" to "tt11057302", + "Condorman (1981)" to "tt0082199", + "My Super Ex-Girlfriend (2006)" to "tt0465624", + "Aquaman and the Lost Kingdom (2023)" to "tt9663764", + "Swamp Thing (1982)" to "tt0084745", + "Zoom (2006)" to "tt0383060", + "The Marvels (2023)" to "tt10676048", + "Superman III (1983)" to "tt0086393", + "Superman II: The Richard Donner Cut (2006)" to "tt0839995", + "Blue Beetle (2023)" to "tt9362930", + "Supergirl (1984)" to "tt0088206", + "Ghost Rider (2007)" to "tt0259324", + "The Flash (2023)" to "tt0439572", + "Superman IV: The Quest for Peace (1987)" to "tt0094074", + "Spider-Man 3 (2007)" to "tt0413300", + "Guardians of the Galaxy Vol. 3 (2023)" to "tt6791350", + "The Incredible Hulk Returns (1988)" to "tt0095368", + "Fantastic Four: Rise of the Silver Surfer (2007)" to "tt0486576", + "Shazam! Fury of the Gods (2023)" to "tt10151854", + "Bionic Showdown: The Six Million Dollar Man and the Bionic Woman (1989)" to "tt0096931", + "Black Lightning (2008)" to "tt1340635", + "Ant-Man and the Wasp: Quantumania (2023)" to "tt10954600", + "The Return of Swamp Thing (1989)" to "tt0098193", + "Iron Man (2008)" to "tt0371746", + "Black Panther: Wakanda Forever (2022)" to "tt9114286", + "Batman (1989)" to "tt0096895", + "The Incredible Hulk (2008)" to "tt0800080", + "Black Adam (2022)" to "tt6443346", + "The Trial of the Incredible Hulk (1989)" to "tt0098512", + "Hellboy II: The Golden Army (2008)" to "tt0411477", + "Thor: Love and Thunder (2022)" to "tt10648342", + "Captain America (1990)" to "tt0103923", + "The Dark Knight (2008)" to "tt0468569", + "Doctor Strange in the Multiverse of Madness (2022)" to "tt9419884", + "The Flash (1990)" to "tt0099580", + "The Spirit (2008)" to "tt0831887", + "Morbius (2022)" to "tt5108870", + "The Death of the Incredible Hulk (1990)" to "tt0099387", + "X-Men Origins: Wolverine (2009)" to "tt0458525", + "The Batman (2022)" to "tt1877830", + "The Rocketeer (1991)" to "tt0102803", + "Iron Man 2 (2010)" to "tt1228705", + "Spider-Man: No Way Home (2021)" to "tt10872600", + "Batman Returns (1992)" to "tt0103776", + "Jonah Hex (2010)" to "tt1075747", + "Eternals (2021)" to "tt9032400", + "The Meteor Man (1993)" to "tt0107563", + "Thor (2011)" to "tt0800369", + "Venom: Let There Be Carnage (2021)" to "tt7097896", + "The Shadow (1994)" to "tt0111143", + "X-Men: First Class (2011)" to "tt1270798", + "Shang-Chi and the Legend of the Ten Rings (2021)" to "tt9376612", + "Blankman (1994)" to "tt0109288", + "Green Lantern (2011)" to "tt1133985", + "Black Widow (2021)" to "tt3480822", + "M.A.N.T.I.S. (1994)" to "tt0110414", + "Captain America: The First Avenger (2011)" to "tt0458339", + "Thunder Force (2021)" to "tt10121392", + "Batman Forever (1995)" to "tt0112462", + "Ghost Rider: Spirit of Vengeance (2011)" to "tt1071875", + "Wonder Woman 1984 (2020)" to "tt7126948", + "The Phantom (1996)" to "tt0117331", + "Chronicle (2012)" to "tt1706593", + "The New Mutants (2020)" to "tt4682266", + "Generation X (1996)" to "tt0116401", + "The Avengers (2012)" to "tt0848228", + "Spider-Man: Far from Home (2019)" to "tt6320628", + "Batman & Robin (1997)" to "tt0118688", + "The Amazing Spider-Man (2012)" to "tt0948470", + "X-Men: Dark Phoenix (2019)" to "tt6565702", + "Spawn (1997)" to "tt0120177", + "The Dark Knight Rises (2012)" to "tt1345836", + "Avengers: Endgame (2019)" to "tt4154796", + "Steel (1997)" to "tt0120207", + "Iron Man 3 (2013)" to "tt1300854", + "Shazam! (2019)" to "tt0448115", + "The Avengers (1998)" to "tt0118661", + "Man of Steel (2013)" to "tt0770828", + "Captain Marvel (2019)" to "tt4154664", + "Nick Fury: Agent of S.H.I.E.L.D. (1998)" to "tt0119781", + "The Wolverine (2013)" to "tt1430132", + "Glass (2019)" to "tt6823368", + "Mystery Men (1999)" to "tt0132347", + "Thor: The Dark World (2013)" to "tt1981115", + "Once Upon a Deadpool (2018)" to "tt31050020", + "X-Men (2000)" to "tt0120903", + "Captain America: The Winter Soldier (2014)" to "tt1843866", + "Aquaman (2018)" to "tt1477834", + "Unbreakable (2000)" to "tt0217869", + "The Amazing Spider-Man 2 (2014)" to "tt1872181", + "Venom (2018)" to "tt1270797", + "Witchblade (2000)" to "tt0169514", + "X-Men: Days of Future Past (2014)" to "tt1877832", + "Ant-Man and the Wasp (2018)" to "tt5095030", + "Spider-Man (2002)" to "tt0145487", + "Guardians of the Galaxy (2014)" to "tt2015381", + "Avengers: Infinity War (2018)" to "tt4154756", + "Daredevil (2003)" to "tt0287978", + "Avengers: Age of Ultron (2015)" to "tt2395427", + "Black Panther (2018)" to "tt1825683", + "X2: X-Men United (2003)" to "tt0290334", + "Ant-Man (2015)" to "tt0478970", + "Justice League (2017)" to "tt0974015", + "Hulk (2003)" to "tt0286716", + "Fantastic Four (2015)" to "tt1502712", + "Thor: Ragnarok (2017)" to "tt3501632", + "Hellboy (2004)" to "tt0167190", + "Captain America: Civil War (2016)" to "tt3498820", + "Spider-Man: Homecoming (2017)" to "tt2250912", + "Spider-Man 2 (2004)" to "tt0316654", + "X-Men: Apocalypse (2016)" to "tt3385516", + "Wonder Woman (2017)" to "tt0451279", + "Catwoman (2004)" to "tt0327554", + "Suicide Squad (2016)" to "tt1386697", + "Guardians of the Galaxy Vol. 2 (2017)" to "tt3896198", + "Doctor Strange (2016)" to "tt1211837", + "The Old Guard 2 (2025)" to "tt14961624", + "The Punisher (1989)" to "tt0098141", + "Constantine (2005)" to "tt0360486", + "Kraven the Hunter (2024)" to "tt8790086", + "Darkman (1990)" to "tt0099365", + "Man-Thing (2005)" to "tt0290747", + "Hellboy: The Crooked Man (2024)" to "tt26757462", + "The Crow (1994)" to "tt0109506", + "The Crow: Wicked Prayer (2005)" to "tt0353324", + "The Crow (2024)" to "tt1340094", + "Judge Dredd (1995)" to "tt0113492", + "Hancock (2008)" to "tt0448157", + "Deadpool & Wolverine (2024)" to "tt6263850", + "Black Scorpion (1995)" to "tt0112519", + "Punisher: War Zone (2008)" to "tt0450314", + "Zack Snyder's Justice League (2021)" to "tt12361974", + "Darkman II: The Return of Durant (1995)" to "tt0109552", + "Watchmen (2009)" to "tt0409459", + "The Suicide Squad (2021)" to "tt6334354", + "Darkman III: Die Darkman Die (1996)" to "tt0116033", + "Defendor (2009)" to "tt1303828", + "Project Power (2020)" to "tt7550000", + "The Crow: City of Angels (1996)" to "tt0115986", + "Kick-Ass (2010)" to "tt1250777", + "The Old Guard (2020)" to "tt7556122", + "Black Scorpion II: Aftershock (1997)" to "tt0115696", + "Super (2010)" to "tt1512235", + "Birds of Prey and the Fantabulous Emancipation of One Harley Quinn (2020)" to "tt7713068", + "Blade (1998)" to "tt0120611", + "Dredd (2012)" to "tt1343727", + "Joker (2019)" to "tt7286456", + "The Crow: Salvation (2000)" to "tt0132910", + "Kick-Ass 2 (2013)" to "tt1650554", + "Freaks (2019)" to "tt8781414", + "Blade II (2002)" to "tt0187738", + "Deadpool (2016)" to "tt1431045", + "Brightburn (2019)" to "tt7752126", + "The Punisher (2004)" to "tt0330793", + "Batman v Superman: Dawn of Justice (2016)" to "tt2975590", + "Hellboy (2019)" to "tt2274648", + "Blade: Trinity (2004)" to "tt0359013", + "Logan (2017)" to "tt3315342", + "Deadpool 2 (2018)" to "tt5463162") } + +internal val HeroesLiveDayParts: List get() { + val refs = HeroesLiveSeriesRefs; val films = HeroesLiveFilms.toSet() + return listOf( + DayPart(21, 23, HeroesLiveFeatures, group = "Feature", once = true, onTime = true, key = "heroeslive.feature", typed = true, seriesRefs = refs, filmEntries = films), + DayPart(1, 3, HeroesLiveLateFilms, group = "Late Feature", once = true, key = "heroeslive.late", typed = true, seriesRefs = refs, filmEntries = films), + DayPart(6, 12, HeroesLiveClassics, key = "heroeslive.classics", typed = true, seriesRefs = refs), + DayPart(12, 21, HeroesLiveContemporary, key = "heroeslive.contemporary", typed = true, seriesRefs = refs), + // After the feature ends, the rest of its window: contemporary shows until 23:00, mature ones until 03:00. + DayPart(21, 23, HeroesLiveContemporary, typed = true, seriesRefs = refs), + DayPart(23, 1, HeroesLiveMature, key = "heroeslive.afterdark", typed = true, seriesRefs = refs), + DayPart(1, 3, HeroesLiveMature, typed = true, seriesRefs = refs), + DayPart(3, 6, HeroesLiveMature + HeroesLiveContemporary, typed = true, seriesRefs = refs)) +} diff --git a/android/app/src/test/java/tv/orbit/classic/ChannelPresetsTest.kt b/android/app/src/test/java/tv/orbit/classic/ChannelPresetsTest.kt index 26956481..f1f706b4 100644 --- a/android/app/src/test/java/tv/orbit/classic/ChannelPresetsTest.kt +++ b/android/app/src/test/java/tv/orbit/classic/ChannelPresetsTest.kt @@ -169,7 +169,7 @@ class ChannelPresetsTest { // Kitchen, Home and Play joined on 6 November 2026. // Americana, OUTLAW, Orbit Stories, Silver Screen and Frontline joined on 23 November 2026; ATLAS on 24 November; // SYNDICATE and PUNCHLINE on 25 November. - assertEquals(45, SmartChannels.size) + assertEquals(46, SmartChannels.size) } @Test fun ringXKeepsItsWeeknightsAndFallsBackToTheVault() { @@ -200,7 +200,7 @@ class ChannelPresetsTest { @Test fun everySmartChannelIsBrandedAndNumberedAfterTheMove() { SmartChannels.forEach { assertNotNull("${it.name} has no brand at ${it.number}", ChannelBrands.forNumber(it.number)) } - assertEquals(OldChannelNumbers.values.toSet() - DRIVE_IN_NUMBER + 101 + TOTS_NUMBER + setOf(108, 109, 110, 205, 206, CHRISTMAS_NUMBER, AMERICANA_NUMBER, OUTLAW_NUMBER, STORIES_NUMBER, SILVER_SCREEN_NUMBER, FRONTLINE_NUMBER, ATLAS_NUMBER, SYNDICATE_NUMBER, PUNCHLINE_NUMBER, WONDER_TV_NUMBER), SmartChannels.map { it.number }.toSet()) + assertEquals(OldChannelNumbers.values.toSet() - DRIVE_IN_NUMBER + 101 + TOTS_NUMBER + setOf(108, 109, 110, 205, 206, CHRISTMAS_NUMBER, AMERICANA_NUMBER, OUTLAW_NUMBER, STORIES_NUMBER, SILVER_SCREEN_NUMBER, FRONTLINE_NUMBER, ATLAS_NUMBER, SYNDICATE_NUMBER, PUNCHLINE_NUMBER, WONDER_TV_NUMBER, HEROES_LIVE_NUMBER), SmartChannels.map { it.number }.toSet()) } @Test fun kitchenHomeAndPlayAreBrandedInTheirBlocks() { diff --git a/android/app/src/test/java/tv/orbit/classic/HeroesLiveBuildSimulationTest.kt b/android/app/src/test/java/tv/orbit/classic/HeroesLiveBuildSimulationTest.kt new file mode 100644 index 00000000..a53629a5 --- /dev/null +++ b/android/app/src/test/java/tv/orbit/classic/HeroesLiveBuildSimulationTest.kt @@ -0,0 +1,77 @@ +package tv.orbit.classic + +import org.json.JSONObject +import org.junit.Assert.assertTrue +import org.junit.Assume.assumeTrue +import org.junit.Test +import java.io.File +import java.time.Instant +import java.time.LocalDateTime +import java.time.ZoneId + +/** + * Heroes Live as built (HeroesLive.kt): the channel's own blocks, runs and film rest, planned for five weeks against a TV + * snapshot's other plans, from the audit's playable episodes and films (film titles plain with their year and IMDb ID, as + * the library gives them; series with their library identity). Env: SIM_SNAP, SIM_HEROES (sim-candidates.json), SIM_OUT. + */ +class HeroesLiveBuildSimulationTest { + @Test fun simulate() { + val dir = System.getenv("SIM_SNAP")?.let(::File); val src = System.getenv("SIM_HEROES")?.let(::File) + assumeTrue(dir != null && dir.isDirectory && src != null && src.exists()) + val out = File(System.getenv("SIM_OUT")!!).also { it.mkdirs() } + val zone = ZoneId.of("Europe/London") + val user = dir!!.listFiles()!!.first { it.name.startsWith("schedule-") }.let { JSONObject(it.readText()).getString("user") } + val store = ScheduleStore(dir) + val p = SmartChannels.first { it.number == HEROES_LIVE_NUMBER } + val doc = JSONObject(src!!.readText()) + val series = doc.getJSONArray("series").let { a -> (0 until a.length()).map { a.getJSONObject(it) } }.map { o -> + val t = o.getString("title").replace(" (1966 series)", " (1966)"); val id = o.getString("id"); val min = o.getInt("minutes") + val eps = o.getJSONArray("episodes").let { a -> (0 until a.length()).map { a.getJSONArray(it) } } + PoolSeries(id, t, eps.map { e -> val s = e.getInt(0); val n = e.getInt(1) + PoolEpisode("$id$s${"%03d".format(n)}", "9$id$s$n", EpisodeMark(s, n), "$t / S$s E$n", min * 60_000L) }, ref = HeroesLiveSeriesRefs[t]?.firstOrNull { it.startsWith("tvdb.") }.orEmpty()) + } + val films = doc.getJSONArray("films").let { a -> (0 until a.length()).map { a.getJSONObject(it) } }.map { o -> + val id = FilmIdentity.of(o.getString("title")) + PoolSeries(o.getString("id"), id.title, listOf(PoolEpisode(o.getString("id"), "9" + o.getString("id"), EpisodeMark(1, 1), id.title, o.getInt("minutes") * 60_000L)), + ref = "imdb." + o.optString("imdb"), year = id.year) + } + val pool = withinRuns(series, p.episodeRuns) + films + val others = (SmartChannels.map { it.number } - setOf(HEROES_LIVE_NUMBER) + DRIVE_IN_NUMBER).mapNotNull { n -> store.loadPlan(user, n)?.let { n to it } }.toMap() + val clash = clashesWithAirings(others.values.flatMap { airingsOf(it) }) + val resting = restingElsewhere(others.values.flatMap { filmAiringsOf(it) }) + val avoid: ProgrammeClash = { show, s, e -> clash(show, s, e) || (show.isFilm && resting(show, s)) } + val mature = p.dayParts.first { it.key == "heroeslive.afterdark" }.titles.map(::seriesKey).toSet() + val late = p.dayParts.first { it.key == "heroeslive.late" }.titles.map { seriesKey(FilmIdentity.of(it).title) }.toSet() + val report = StringBuilder("pool: ${series.size} series, ${films.size} films\n"); val checks = mutableListOf() + for ((label, start) in listOf("december" to LocalDateTime.of(2026, 12, 1, 6, 0), "march" to LocalDateTime.of(2027, 3, 1, 6, 0))) { + val now = start.atZone(zone).toInstant().toEpochMilli() + val all = LinkedHashMap(); var plan: ChannelPlan? = null; var aired = ScheduleCursor(); var kept = true + for (d in 0 until 35) { + plan?.let { aired = airedCursor(aired, it.entries, now + d * 86_400_000L) } + plan = topUpPlan(plan, aired, pool, now + d * 86_400_000L, p.filmRestMs, p.finishTogether, p.dayParts, zone, avoid = avoid, shuffle = p.shuffleEpisodes, + mixed = p::mixes, weightOf = p.tierWeights?.let { p::weightOf }, fileRestMs = p.fileRestMs, stories = p.storyGrouping, network = NoNetworkRest)!! + plan.entries.forEach { e -> all["${e.startMs}"]?.let { if (it != e) kept = false } ?: run { all["${e.startMs}"] = e } } + } + val entries = all.values.sortedBy { it.startMs } + fun local(ms: Long) = Instant.ofEpochMilli(ms).atZone(zone) + fun show(e: ScheduleEntry) = pool.first { it.id == e.seriesId } + File(out, "plan-115-$label.tsv").writeText(entries.joinToString("\n") { "${local(it.startMs).toLocalDateTime()}\t${(it.endMs - it.startMs) / 60_000}\t${it.media.item.title}\t${show(it).isFilm}\t${presentationOf(it, p.dayParts, zone)}" }) + val filmsAired = entries.filter { show(it).isFilm } + val matureEarly = entries.count { e -> local(e.startMs).hour in 6..22 && (seriesKey(show(e).title) in mature && !show(e).isFilm || show(e).isFilm && seriesKey(show(e).title) in late) } + val featureOff = filmsAired.count { e -> seriesKey(show(e).title) !in late && local(e.startMs).hour !in 21..22 } + val days = (0 until 34).map { start.toLocalDate().plusDays(it.toLong()) } + val noFeature = days.count { day -> filmsAired.none { local(it.startMs).toLocalDate() == day && local(it.startMs).hour in 21..22 } } + val clashes = entries.count { clash(show(it), it.startMs, it.endMs) } + val restBroken = filmsAired.count { resting(show(it), it.startMs) } + val order = entries.filter { !show(it).isFilm }.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 } } + val pastRun = entries.count { e -> p.episodeRuns[show(e).title]?.let { r -> e.mark.season > r.season || (e.mark.season == r.season && e.mark.episode > r.episode) } == true } + val guests = filmsAired.count { e -> HeroesLiveGuests.any { seriesKey(FilmIdentity.of(it).title) == seriesKey(show(e).title) } } + report.append("$label: ${entries.size} programmes; films ${filmsAired.size} (guests $guests); mature before 23:00 $matureEarly; features off 21:00 $featureOff; nights without a feature $noFeature; " + + "clashes $clashes; guest rest broken $restBroken; out of order $order; past a serial's run $pastRun; bookings kept $kept\n") + checks += listOf(matureEarly == 0, featureOff == 0, noFeature == 0, clashes == 0, restBroken == 0, order == 0, pastRun == 0, kept) + } + File(out, "summary.txt").writeText(report.toString()); println(report) + assertTrue(report.toString(), checks.all { it }) + } +} diff --git a/android/app/src/test/java/tv/orbit/classic/HeroesLiveChannelTest.kt b/android/app/src/test/java/tv/orbit/classic/HeroesLiveChannelTest.kt new file mode 100644 index 00000000..2aa48261 --- /dev/null +++ b/android/app/src/test/java/tv/orbit/classic/HeroesLiveChannelTest.kt @@ -0,0 +1,63 @@ +package tv.orbit.classic + +import org.junit.Assert.assertEquals +import org.junit.Assert.assertFalse +import org.junit.Assert.assertTrue +import org.junit.Test + +/** Heroes Live (Paul, 30 November 2026): its lists, its typed blocks, its runs and its guests. */ +class HeroesLiveChannelTest { + private val p = SmartChannels.first { it.number == HEROES_LIVE_NUMBER } + private fun series(title: String, ref: String = "") = PoolSeries("s-$title", title, listOf(PoolEpisode("e1", "m1", EpisodeMark(1, 1), "$title / S1 E1", 60_000L), PoolEpisode("e2", "m2", EpisodeMark(1, 2), "$title / S1 E2", 60_000L)), ref = ref) + private fun film(title: String, year: Int, imdb: String) = PoolSeries("f-$imdb", title, listOf(PoolEpisode("f-$imdb", "m", EpisodeMark(1, 1), title, 60_000L)), ref = "imdb.$imdb", year = year) + + @Test fun itsListsAndFilms() { + assertEquals("Heroes Live", p.name) + assertEquals(65, p.searches.size) + assertEquals(180, p.channelFilms.size) + assertTrue(p.channelFilms.all { FilmIdentity.of(it).year != null && FilmIdentity.of(it).imdb?.startsWith("tt") == true }) + assertFalse("held until its pilot is in the library", "Lois & Clark: The New Adventures of Superman" in p.searches) + listOf("Gotham", "Naomi", "The Flash (1990)", "The Gifted", "Superman (1948)", "Smallville", "Sapphire and Steel").forEach { assertFalse(it, it in p.searches) } + assertTrue(p.dayParts.all { it.typed }) + } + + @Test fun aFilmAndASeriesThatShareANameNeverStandInForEachOther() { + // The 06:00 anomaly (30 November 2026): the Batman (1966) series' block picked up the Batman (1966) film. + val classics = p.dayParts.first { it.key == "heroeslive.classics" } + val tvBatman = series("Batman (1966)", "tvdb.77871"); val filmBatman = film("Batman (1966)", 1966, "tt0060153") + val (allowed, _, _) = dayPartFor(listOf(tvBatman, filmBatman), listOf(classics), java.time.LocalDate.of(2026, 12, 1).atTime(8, 0).atZone(java.time.ZoneId.of("Europe/London")).toInstant().toEpochMilli(), java.time.ZoneId.of("Europe/London")) + assertTrue(tvBatman in allowed); assertFalse(filmBatman in allowed) + // The same name in the film list and the series list still means two programmes: the feature takes the film only. + val feature = p.dayParts.first { it.key == "heroeslive.feature" } + val evening = java.time.LocalDate.of(2026, 12, 1).atTime(21, 0).atZone(java.time.ZoneId.of("Europe/London")).toInstant().toEpochMilli() + val (atNine, _, _) = dayPartFor(listOf(tvBatman, filmBatman), listOf(feature), evening, java.time.ZoneId.of("Europe/London")) + assertTrue(filmBatman in atNine); assertFalse(tvBatman in atNine) + } + + @Test fun aSeriesIsMatchedByItsIdentityNotOnlyItsName() { + val afternoon = p.dayParts.first { it.key == "heroeslive.contemporary" } + val refs = HeroesLiveSeriesRefs.getValue("Arrow") + val zone = java.time.ZoneId.of("Europe/London"); val at = java.time.LocalDate.of(2026, 12, 1).atTime(14, 0).atZone(zone).toInstant().toEpochMilli() + assertTrue(series("Arrow", refs.first()) in dayPartFor(listOf(series("Arrow", refs.first())), listOf(afternoon), at, zone).third.let { listOf(series("Arrow", refs.first())) }) + val impostor = series("Arrow", "tvdb.999999999") + assertFalse(afternoon.names(impostor, afternoon.titles.map(::seriesKey).toSet(), afternoon.titles.map(FilmIdentity::of))) + assertTrue(afternoon.names(series("Arrow", refs.first()), afternoon.titles.map(::seriesKey).toSet(), afternoon.titles.map(FilmIdentity::of))) + } + + @Test fun serialsStopBeforeTheirFirstGap() { + val arrow = PoolSeries("a", "Arrow", listOf(EpisodeMark(6, 2), EpisodeMark(6, 3), EpisodeMark(6, 5), EpisodeMark(7, 1)).map { PoolEpisode("a${it.season}${it.episode}", "m", it, "Arrow", 60_000L) }) + assertEquals(listOf(EpisodeMark(6, 2), EpisodeMark(6, 3)), withinRuns(listOf(arrow), p.episodeRuns).single().episodes.map { it.mark }) + assertEquals(HeroesLiveRuns, p.episodeRuns) + } + + @Test fun guestsAndMatureFilmsKeepTheirPlace() { + assertEquals(NETWORK_FILM_REST_MS, p.fileRestMs) + listOf("Blade (1998)", "Dredd (2012)", "Joker (2019)", "Deadpool (2016)", "The Batman (2022)").forEach { assertTrue(it, it in HeroesLiveGuests) } + val late = p.dayParts.first { it.key == "heroeslive.late" }; val feature = p.dayParts.first { it.key == "heroeslive.feature" } + assertTrue("Logan (2017)" in late.titles && "Logan (2017)" !in feature.titles) + assertTrue(feature.once && feature.onTime && feature.fromHour == 21) + // Nothing mature before 23:00: the mature series are only in the after-dark and overnight blocks. + val mature = p.dayParts.first { it.key == "heroeslive.afterdark" }.titles.toSet() + p.dayParts.filter { it.fromHour in 6..21 && it.fromHour != 3 }.forEach { part -> assertTrue(part.key, part.titles.none { it in mature }) } + } +} diff --git a/android/app/src/test/java/tv/orbit/classic/PpvSundayTest.kt b/android/app/src/test/java/tv/orbit/classic/PpvSundayTest.kt index b1a3042d..57d9f2e0 100644 --- a/android/app/src/test/java/tv/orbit/classic/PpvSundayTest.kt +++ b/android/app/src/test/java/tv/orbit/classic/PpvSundayTest.kt @@ -88,7 +88,7 @@ class PpvSundayTest { // ATLAS (24 November 2026): its film events, from its own list. // SYNDICATE (25 November 2026): films in its everyday blocks and events, from its own list. // Wonder TV (30 November 2026): its TV movies in Featured. - assertEquals(listOf(ATLAS_NUMBER, SYNDICATE_NUMBER, 401, WONDER_TV_NUMBER), SmartChannels.filter { it.channelFilms.isNotEmpty() }.map { it.number }.sorted()) + assertEquals(listOf(ATLAS_NUMBER, SYNDICATE_NUMBER, HEROES_LIVE_NUMBER, 401, WONDER_TV_NUMBER), SmartChannels.filter { it.channelFilms.isNotEmpty() }.map { it.number }.sorted()) } @Test fun ringXReadsItsEventsAgainWhenTheListChanges() {