0.99.6: After Dark review applied (38 exact items withdrawn, 5 films moved to Horror), with 0.99.5
pauljd/davidson-ci: Davidson CI / quality (push) Failing after 1m41s
pauljd/davidson-ci: Davidson CI / ai-review (push) Failing after 1m34s

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-11-04 09:31:57 +00:00
co-authored by Claude Opus 5.5
parent 99ed169955
commit d4a67212b7
10 changed files with 239 additions and 9 deletions
@@ -54,7 +54,9 @@ internal val ChannelPresets = listOf(
ChannelPreset(306, "Orbit VHS", listOf("Back to the Future", "Back to the Future Part II", "Back to the Future Part III", "The Goonies", "Gremlins", "Gremlins 2: The New Batch", "Ghostbusters (1984)", "Ghostbusters II", "E.T. the Extra-Terrestrial", "Honey, I Shrunk the Kids", "Flight of the Navigator", "The NeverEnding Story", "Labyrinth (1986)", "Willow", "The Princess Bride", "Short Circuit", "Batteries Not Included", "Explorers", "Stand by Me", "The Karate Kid (1984)", "The Karate Kid Part II",
"Ferris Bueller's Day Off", "The Breakfast Club", "Weird Science", "Teen Wolf", "Bill & Ted's Excellent Adventure", "Bill & Ted's Bogus Journey", "Wayne's World (1992)", "Big (1988)", "Home Alone", "Home Alone 2: Lost in New York", "Beetlejuice", "Hook (1991)", "Jumanji", "Mrs. Doubtfire", "Mac and Me", "Police Academy", "Top Gun", "Crocodile Dundee", "Who Framed Roger Rabbit", "Howard the Duck", "Masters of the Universe (1987)", "Innerspace", "Big Trouble in Little China", "Three Amigos", "Spaceballs", "Short Circuit 2", "Adventures in Babysitting (1987)", "Uncle Buck", "Planes, Trains and Automobiles", "National Lampoon's Vacation", "National Lampoon's European Vacation", "National Lampoon's Christmas Vacation", "Airplane! (1980)", "The Naked Gun: From the Files of Police Squad!", "The Naked Gun 2½: The Smell of Fear", "Hot Shots! (1991)", "Police Academy 2: Their First Assignment", "Trading Places", "Coming to America", "Beverly Hills Cop", "Beverly Hills Cop II", "48 Hrs.", "Twins", "Kindergarten Cop", "Honey, I Blew Up the Kid", "Dragnet (1987)", "Caddyshack", "Stripes", "Tootsie", "The Blues Brothers", "Sixteen Candles", "Pretty in Pink", "St. Elmo's Fire", "Say Anything...", "Heathers", "Better Off Dead (1985)", "Can't Buy Me Love", "Back to School", "Real Genius", "D.A.R.Y.L.", "The Last Starfighter", "Cocoon (1985)", "The Dark Crystal", "Time Bandits", "Legend (1985)", "Krull", "Conan the Barbarian (1982)", "Red Sonja (1985)", "Highlander", "Mannequin (1987)", "Harry and the Hendersons", "The Witches (1990)", "Hocus Pocus (1993)", "Jumanji", "The Mighty Ducks", "Cool Runnings"), smartOnly = true, films = true),
ChannelPreset(303, "Orbit Sci-Fi", listOf("2001: A Space Odyssey", "Star Wars", "The Empire Strikes Back", "Return of the Jedi", "Alien (1979)", "Aliens", "Blade Runner", "The Terminator", "Terminator 2: Judgment Day", "RoboCop (1987)", "Total Recall (1990)", "Predator (1987)", "Stargate", "Starship Troopers", "The Fifth Element", "Contact (1997)", "Gattaca", "Dark City (1998)", "The Matrix", "Pitch Black (2000)", "Event Horizon", "Sunshine (2007)", "Moon (2009)", "District 9", "Inception", "Interstellar", "Gravity (2013)", "The Martian", "Arrival (2016)", "Ex Machina", "Dune (2021)", "Edge of Tomorrow", "Minority Report", "Looper", "Children of Men", "Star Trek II: The Wrath of Khan", "Star Trek: First Contact", "Star Trek", "Tron", "Close Encounters of the Third Kind", "The Abyss (1989)", "Independence Day", "Men in Black (1997)", "Serenity (2005)", "Planet of the Apes (1968)", "Soylent Green", "Logan's Run", "Primer", "Blade Runner 2049", "Dune: Part Two", "Alien 3", "Alien³ (1992)", "Alien Resurrection", "Prometheus", "Terminator 3: Rise of the Machines", "Terminator Salvation", "The Matrix Reloaded", "The Matrix Revolutions", "Twelve Monkeys", "Brazil (1985)", "A Clockwork Orange", "V for Vendetta", "Her", "Rogue One: A Star Wars Story", "Solo: A Star Wars Story", "Star Wars: Episode I - The Phantom Menace", "Star Wars: Episode II - Attack of the Clones", "Star Wars: Episode III - Revenge of the Sith", "Star Wars: The Force Awakens", "Star Wars: The Last Jedi", "Star Wars: The Rise of Skywalker", "Star Trek: The Motion Picture", "Star Trek III: The Search for Spock", "Star Trek IV: The Voyage Home", "Star Trek Into Darkness", "Star Trek Beyond", "Elysium", "Oblivion (2013)", "Source Code", "In Time", "I, Robot", "A.I. Artificial Intelligence", "War of the Worlds (2005)", "Predator 2", "RoboCop 2", "Deep Impact", "Annihilation", "Upgrade", "Tenet", "Ad Astra", "Passengers (2016)", "Lucy (2014)", "Limitless (2011)", "Galaxy Quest", "Flash Gordon (1980)", "Silent Running", "The Day the Earth Stood Still (1951)", "Forbidden Planet", "Westworld", "The Andromeda Strain", "Serenity (2005)"), smartOnly = true, films = true),
ChannelPreset(304, "Orbit Horror", listOf("A Nightmare on Elm Street (1984)", "Friday the 13th (1980)", "The Texas Chain Saw Massacre", "Night of the Living Dead (1968)", "Dawn of the Dead (1978)", "The Exorcist", "The Omen (1976)", "The Shining", "Carrie (1976)", "Pet Sematary (1989)", "It (2017)", "Misery", "Child's Play (1988)", "Candyman (1992)", "Jaws", "The Blair Witch Project", "The Ring (2002)", "Saw", "Hostel (2006)", "The Descent (2005)", "Insidious", "The Conjuring", "Sinister", "Hereditary", "Midsommar", "The Witch (2016)", "It Follows", "Get Out (2017)", "A Quiet Place", "Rosemary's Baby", "Psycho (1960)", "The Birds", "Black Christmas (1974)", "Sleepaway Camp", "Maniac (1980)", "The Hills Have Eyes (1977)", "Critters", "Leprechaun", "Pumpkinhead", "Army of Darkness", "Evil Dead II", "Braindead", "The Mist", "Drag Me to Hell", "The Babadook", "Train to Busan", "Ringu", "Barbarian (2022)", "A Nightmare on Elm Street 3: Dream Warriors", "Friday the 13th Part 2", "Halloween II (1981)", "Scream 2", "Scream 3", "Sinister 2", "Insidious: Chapter 2", "The Conjuring 2", "Annabelle", "Annabelle: Creation", "The Nun (2018)", "It Chapter Two", "Saw II", "Saw III", "The Cabin in the Woods", "Cloverfield", "[REC] (2007)", "The Orphanage (2007)", "Let the Right One In", "Let Me In", "Paranormal Activity", "Paranormal Activity 2", "The Purge (2013)", "Us (2019)", "Nope", "Smile (2022)", "Talk to Me (2023)", "Final Destination (2000)", "Final Destination 2", "Final Destination 3", "Wrong Turn (2003)", "House of 1000 Corpses", "The Devil's Rejects", "Jeepers Creepers", "The Strangers (2008)", "You're Next", "Hush (2016)", "The Autopsy of Jane Doe", "Gerald's Game", "Doctor Sleep (2019)", "1408", "The Others (2001)", "The Sixth Sense", "Sleepy Hollow", "Pet Sematary Two", "Children of the Corn (1984)", "The Amityville Horror (1979)", "The Texas Chainsaw Massacre (2003)", "Hellbound: Hellraiser II", "Ghostwatch", "The Innocents (1961)", "The Haunting (1963)",
ChannelPreset(304, "Orbit Horror", listOf("A Nightmare on Elm Street (1984)",
// Moved from After Dark (Paul, 4 November 2026).
"Bram Stoker's Dracula (1992)", "Interview with the Vampire (1994)", "Red Dragon (2002)", "Sweeney Todd: The Demon Barber of Fleet Street (2007)", "The Devil's Advocate (1997)", "Friday the 13th (1980)", "The Texas Chain Saw Massacre", "Night of the Living Dead (1968)", "Dawn of the Dead (1978)", "The Exorcist", "The Omen (1976)", "The Shining", "Carrie (1976)", "Pet Sematary (1989)", "It (2017)", "Misery", "Child's Play (1988)", "Candyman (1992)", "Jaws", "The Blair Witch Project", "The Ring (2002)", "Saw", "Hostel (2006)", "The Descent (2005)", "Insidious", "The Conjuring", "Sinister", "Hereditary", "Midsommar", "The Witch (2016)", "It Follows", "Get Out (2017)", "A Quiet Place", "Rosemary's Baby", "Psycho (1960)", "The Birds", "Black Christmas (1974)", "Sleepaway Camp", "Maniac (1980)", "The Hills Have Eyes (1977)", "Critters", "Leprechaun", "Pumpkinhead", "Army of Darkness", "Evil Dead II", "Braindead", "The Mist", "Drag Me to Hell", "The Babadook", "Train to Busan", "Ringu", "Barbarian (2022)", "A Nightmare on Elm Street 3: Dream Warriors", "Friday the 13th Part 2", "Halloween II (1981)", "Scream 2", "Scream 3", "Sinister 2", "Insidious: Chapter 2", "The Conjuring 2", "Annabelle", "Annabelle: Creation", "The Nun (2018)", "It Chapter Two", "Saw II", "Saw III", "The Cabin in the Woods", "Cloverfield", "[REC] (2007)", "The Orphanage (2007)", "Let the Right One In", "Let Me In", "Paranormal Activity", "Paranormal Activity 2", "The Purge (2013)", "Us (2019)", "Nope", "Smile (2022)", "Talk to Me (2023)", "Final Destination (2000)", "Final Destination 2", "Final Destination 3", "Wrong Turn (2003)", "House of 1000 Corpses", "The Devil's Rejects", "Jeepers Creepers", "The Strangers (2008)", "You're Next", "Hush (2016)", "The Autopsy of Jane Doe", "Gerald's Game", "Doctor Sleep (2019)", "1408", "The Others (2001)", "The Sixth Sense", "Sleepy Hollow", "Pet Sematary Two", "Children of the Corn (1984)", "The Amityville Horror (1979)", "The Texas Chainsaw Massacre (2003)", "Hellbound: Hellraiser II", "Ghostwatch", "The Innocents (1961)", "The Haunting (1963)",
// Slasher Saturday.
"Halloween (1978)", "Scream (1996)", "My Bloody Valentine (1981)", "Prom Night (1980)", "Terror Train (1980)", "The Burning (1981)", "Happy Birthday to Me",
"April Fool's Day (1986)", "Silent Night, Deadly Night (1984)", "The Prowler (1981)", "Hell Night", "Hatchet", "I Know What You Did Last Summer (1997)",
@@ -50,7 +50,9 @@ internal data class ChannelProgramming(val number: Int, val name: String, val se
* Weighted channels only: a show with fewer hours of episodes than this has its tier's weight scaled down by its size,
* so a short catalogue comes round at a pace it can sustain instead of every week. Null keeps every tier whole.
*/
val catalogueScaleHours: Double? = null) {
val catalogueScaleHours: Double? = null,
/** Library items taken off this channel by editorial decision, by their Emby id, whichever way they reached its pool. */
val withdrawn: Set<String> = emptySet()) {
/** A show's weight here, by its tier (a show the brief doesn't name counts as supporting), scaled by [catalogueScaleHours]. */
fun weightOf(show: PoolSeries): Double {
val tier = tierWeights?.get(seriesKey(show.title)) ?: TIER_SUPPORTING
@@ -61,7 +63,8 @@ internal data class ChannelProgramming(val number: Int, val name: String, val se
fun mixes(show: PoolSeries) = shuffleEpisodes || seriesKey(show.title) in shuffleTitles.mapTo(HashSet(), ::seriesKey)
/** Changes when the list does, so the episode cache is read again. What's already committed stays. */
val signature get() = "$CHANNEL_POOL_VERSION#${searches.joinToString("|")}#$seriesCount" +
(if (filmSeries.isEmpty()) "" else "#series:${filmSeries.joinToString("|")}") + (if (channelFilms.isEmpty()) "" else "#films:${channelFilms.joinToString("|")}")
(if (filmSeries.isEmpty()) "" else "#series:${filmSeries.joinToString("|")}") + (if (channelFilms.isEmpty()) "" else "#films:${channelFilms.joinToString("|")}") +
(if (withdrawn.isEmpty()) "" else "#withdrawn:${withdrawn.sorted().joinToString("|")}")
}
/** Expect the unexpected: standalone adventures by day in a mixed order, cult drama in order in prime time, and the strange stuff late. */
@@ -73,6 +76,55 @@ private val ParadoxDayParts get() = listOf(DayPart(6, 18, ParadoxStandalones), D
private val NotCultCinema = setOf("Family", "Animation", "Documentary", "Music")
/**
* Films taken off After Dark by Paul's review of its accepted suggestions (4 November 2026), by Emby item id, so only that
* exact file is affected. Committed bookings of them still air; nothing is deleted from the library.
*/
private val AfterDarkWithdrawn get() = setOf(
// Off-brief: not cult, horror or midnight cinema.
"5653603", // Koi... Mil Gaya (2003)
"6408313", // Mystic River (2003)
"5696436", // Missing (1982)
"6402358", // An American Crime (2007)
"6333313", // I... for Icarus (1979)
"7761503", // Splendid Outing (1978)
"7890117", // Murder by Natural Causes (1979)
"6057366", // The Hound of the Baskervilles (1988)
"6038274", // The Name of the Rose (1986)
"5691273", // Helter Skelter (1976)
"6852241", // Demons (1971)
"6052574", // Lock In (2008)
"7922361", // Moonshine (2006)
"7201786", // Extra Weird Sampler (2003)
"6413988", // The Game (1997)
"5719177", // Equilibrium (2002)
// Lynch extra material, not a feature: kept in mind as a possible special extra later.
"6054754", // More Things That Happened (2007)
// Mainstream: the same file stays on its home channel (checked by item id).
"7181086", // 28 Days Later (2002), BritX
"5847594", // Shaun of the Dead (2004), BritX
"5172810", // Alien (1979), Sci-Fi
"5660979", // Predator (1987), Sci-Fi
"6413356", // Starship Troopers (1997), Sci-Fi
"6399911", // A Nightmare on Elm Street (1984), Horror
"5705956", // Carrie (1976), Horror
"5666477", // Jaws (1975), Horror
"5847589", // Saw (2004), Horror
"6414383", // Sleepy Hollow (1999), Horror
"5710549", // The Exorcist (1973), Horror
"5710354", // The Omen (1976), Horror
"7958204", // The Orphanage (2007), Horror
"5671738", // The Others (2001), Horror
"5660745", // The Shining (1980), Horror
"5669960", // Gremlins (1984), VHS
// Moved to Horror (its list now names them).
"5638364", // Bram Stoker's Dracula (1992)
"6044302", // Interview with the Vampire (1994)
"6049755", // Red Dragon (2002)
"6414670", // Sweeney Todd: The Demon Barber of Fleet Street (2007)
"5718634", // The Devil's Advocate (1997)
)
/** After Dark reads every film on its list, as the other film channels do. Reviewed suggestions join on top. */
private val AfterDarkFilms = listOf("The Thing (1982)", "The Evil Dead (1983)", "Re-Animator", "Hellraiser (1987)", "Videodrome", "An American Werewolf in London",
"Halloween (1978)", "Day of the Dead (1985)", "They Live", "Escape from New York", "The Fog (1980)", "Near Dark", "The Lost Boys (1987)", "Fright Night (1985)", "Society", "Tremors (1990)",
@@ -88,6 +140,7 @@ private val AfterDarkFilms = listOf("The Thing (1982)", "The Evil Dead (1983)",
internal val SmartChannels = listOf(
ChannelProgramming(AFTER_DARK_NUMBER, "After Dark", AfterDarkFilms, seriesCount = AfterDarkFilms.size, filmSeries = listOf(LAST_DRIVE_IN), filmRestMs = 7 * 24 * 60 * 60_000L, adaptiveFilmRest = true,
withdrawn = AfterDarkWithdrawn,
dayParts = AfterDarkEvents + listOf(DayPart(21, 5), DayPart(5, 21, listOf("The 'Burbs", "'Til Death Do Us Part (2017)", "Tremors (1990)", "The Lost Boys (1987)", "Fright Night (1985)", "Poltergeist (1982)", "Scream (1996)",
"Escape from New York", "They Live", "Repo Man", "Donnie Darko", "From Dusk Till Dawn", "Creepshow", "Near Dark", "Halloween (1978)", "The Fog (1980)", "Blue Velvet",
"The Wicker Man (1973)", "An American Werewolf in London", "Prince of Darkness"), group = "day")),
@@ -238,6 +291,10 @@ internal fun turnOrder(pool: List<PoolSeries>, last: String?): List<PoolSeries>
return (0 until pool.size).map { pool[(after + it) % pool.size] }
}
/** A pool without the items taken off a channel by editorial decision ([ChannelProgramming.withdrawn]). */
internal fun withoutWithdrawn(pool: List<PoolSeries>, withdrawn: Set<String>): List<PoolSeries> =
if (withdrawn.isEmpty()) pool else pool.filter { show -> show.id !in withdrawn && show.episodes.none { it.id in withdrawn } }
/** A pool without files known not to play. A show with nothing left drops out. */
internal fun withoutFailed(pool: List<PoolSeries>, failed: Set<String>): List<PoolSeries> =
if (failed.isEmpty()) pool else pool.map { show -> show.copy(episodes = show.episodes.filter { it.id !in failed }) }.filter { it.episodes.isNotEmpty() }
@@ -66,7 +66,7 @@ internal class HttpsEmbyTransport(internal val deviceId: String = UUID.randomUUI
connection.connectTimeout = 10_000
connection.readTimeout = request.readTimeoutMs ?: if (request.path == "/Sessions/Logout") 5_000 else 15_000
connection.setRequestProperty("Accept", "application/json")
connection.setRequestProperty("X-Emby-Authorization", "Emby Client=\"Orbit TV\", Device=\"Orbit TV\", DeviceId=\"$deviceId\", Version=\"0.99.5\"")
connection.setRequestProperty("X-Emby-Authorization", "Emby Client=\"Orbit TV\", Device=\"Orbit TV\", DeviceId=\"$deviceId\", Version=\"0.99.6\"")
request.token?.let { connection.setRequestProperty("X-Emby-Token", it) }
if (request.method == "POST") {
val bytes = request.body.orEmpty().toByteArray(Charsets.UTF_8)
@@ -278,7 +278,8 @@ internal class EmbySampleSession(private val transport: EmbyTransport, private v
if (whole.episodes.isNotEmpty()) pool += whole.copy(group = accepted.group)
}
}
return PoolRead(pool, requests)
// An editorial withdrawal takes that exact item out, however it arrived: list, old line-up or accepted suggestion.
return PoolRead(withoutWithdrawn(pool, programming.withdrawn), requests)
}
fun suggestFor(rules: List<SuggestionRule>, alreadyInPool: Set<String>, rejected: Set<String>, takenTitles: Set<String> = emptySet(), checkActive: () -> Unit = {}) =
findSuggestions(transport, userId, ::currentToken, rules, alreadyInPool, rejected, checkActive, BoxDecoders::canDecode, takenTitles, englishAudio = true)
@@ -33,7 +33,7 @@ internal class SecureMediaDataSource(private val session: EmbySampleSession) : B
next.instanceFollowRedirects = false
next.connectTimeout = 10_000
next.readTimeout = 20_000
next.setRequestProperty("User-Agent", "OrbitTV/0.99.5")
next.setRequestProperty("User-Agent", "OrbitTV/0.99.6")
next.setRequestProperty("Accept-Encoding", "identity")
session.mediaHeaders(address).forEach { (key, value) -> next.setRequestProperty(key, value) }
if (dataSpec.position != 0L || dataSpec.length != C.LENGTH_UNSET.toLong()) {
@@ -0,0 +1,36 @@
package tv.orbit.classic
import org.junit.Assert.assertEquals
import org.junit.Assert.assertTrue
import org.junit.Test
/** Paul's After Dark review (4 November 2026): exact items withdrawn, five films moved to Horror, nothing else touched. */
class AfterDarkReviewTest {
private val afterDark get() = SmartChannels.first { it.number == AFTER_DARK_NUMBER }
private val horror get() = SmartChannels.first { it.number == 304 }
private val moved = listOf("Bram Stoker's Dracula (1992)", "Interview with the Vampire (1994)", "Red Dragon (2002)", "Sweeney Todd: The Demon Barber of Fleet Street (2007)", "The Devil's Advocate (1997)")
@Test fun thirtyEightExactItemsLeaveAfterDarkAndOnlyThere() {
assertEquals(38, afterDark.withdrawn.size)
assertTrue(afterDark.withdrawn.all { EmbyClient.validId(it) })
assertTrue(SmartChannels.filter { it.number != AFTER_DARK_NUMBER }.all { it.withdrawn.isEmpty() })
// The kept films are untouched: nothing withdrawn is on After Dark's own list.
val film = { id: String, title: String -> PoolSeries(id, title, listOf(PoolEpisode(id, "src", EpisodeMark(1, 1), title, 6_000_000))) }
val pool = listOf(film("5653603", "Koi... Mil Gaya"), film("5660745", "The Shining"), film("1", "Zombieland"), film("2", "Black Swan"), film("3", "Terrorizers"), film("4", "The Outcasts"))
assertEquals(listOf("Zombieland", "Black Swan", "Terrorizers", "The Outcasts"), withoutWithdrawn(pool, afterDark.withdrawn).map { it.title })
assertEquals(pool, withoutWithdrawn(pool, emptySet()))
}
@Test fun fiveFilmsMoveToHorrorByExactTitleAndYear() {
moved.forEach { title ->
assertTrue("Horror lists $title", title in horror.searches)
assertTrue("After Dark doesn't list $title", afterDark.searches.none { seriesKey(FilmIdentity.of(it).title) == seriesKey(FilmIdentity.of(title).title) })
assertTrue(FilmIdentity.of(title).year != null)
}
}
@Test fun onlyAfterDarkAndHorrorReadTheirPoolsAgain() {
assertTrue("#withdrawn:" in afterDark.signature)
assertTrue(SmartChannels.filter { it.number != AFTER_DARK_NUMBER }.none { "#withdrawn:" in it.signature })
}
}
@@ -93,6 +93,6 @@ class PpvSundayTest {
assertTrue(ringX.signature.contains("#films:"))
assertTrue(ringX.signature.contains(PpvSunday.first()))
val afterDark = SmartChannels.first { it.number == AFTER_DARK_NUMBER }
assertTrue(afterDark.signature.endsWith("#series:$LAST_DRIVE_IN"))
assertTrue(afterDark.signature.contains("#series:$LAST_DRIVE_IN#"))
}
}