0.94.0: PPV Sunday on Ring X (opt-in event films, one a night, near 19:00)
pauljd/davidson-ci: Davidson CI / quality (push) Failing after 1m47s
pauljd/davidson-ci: Davidson CI / ai-review (push) Failing after 1m27s

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-11-03 15:56:35 +00:00
co-authored by Claude Opus 5.5
parent c9928482cb
commit 6f3f1e5c19
11 changed files with 375 additions and 174 deletions
+2 -2
View File
@@ -9,8 +9,8 @@ android {
applicationId = "tv.orbit.classic"
minSdk = 26
targetSdk = 36
versionCode = 115
versionName = "0.93.0-junior-and-ring-x"
versionCode = 116
versionName = "0.94.0-ppv-sunday"
}
buildFeatures { compose = true }
compileOptions { sourceCompatibility = JavaVersion.VERSION_17; targetCompatibility = JavaVersion.VERSION_17 }
@@ -334,5 +334,21 @@ internal val RingXDayParts get() = listOf(
DayPart(18, 23, RingXMonday, days = setOf(DayOfWeek.MONDAY)), DayPart(18, 23, RingXTuesday, days = setOf(DayOfWeek.TUESDAY)),
DayPart(18, 23, RingXWednesday, days = setOf(DayOfWeek.WEDNESDAY)), DayPart(18, 23, RingXThursday, days = setOf(DayOfWeek.THURSDAY)),
DayPart(18, 23, RingXFriday, days = setOf(DayOfWeek.FRIDAY)), DayPart(18, 23, RingXSaturday, days = setOf(DayOfWeek.SATURDAY)),
// Sunday evening is the vault until PPV Sunday is built.
// PPV Sunday: one event, starting near 19:00 and running to its natural end, however late.
DayPart(19, 20, PpvSunday, days = setOf(DayOfWeek.SUNDAY), onTime = true, once = true),
DayPart(6, 23, RingXDaytimeVault), DayPart(23, 6, RingXLate))
/**
* PPV Sunday: 52 events from the library, a year without a repeat, in this order. Promotions and eras are spaced through the year;
* the order is programming, not history. Named with their year where the library has another event of that name.
*/
internal val PpvSunday = listOf("WWE WrestleMania III", "WCW Capital Combat: The Return of RoboCop", "ECW Hardcore Heaven 1996", "AEW Double or Nothing 2019", "WWE WrestleMania 39 Sunday",
"NWA Starrcade 1983", "WWE Survivor Series 1987", "NJPW Wrestle Kingdom 11", "TNA Unbreakable 2005", "WCW Fall Brawl 1997", "WWE Royal Rumble 2022",
"ECW One Night Stand 2005", "AEW: All In 2023", "ROH: Supercard of Honor XII", "WWE SummerSlam 1988", "WCW SuperBrawl II", "WWE Evolution (2018)",
"ECW Barely Legal 1997", "WWE WrestleMania VI", "NWA WrestleWar '89: The Music City Showdown", "WCW World War 3 1996", "AEW All Out (2019)",
"WWE WrestleMania XXX", "ECW Anarchy Rulz 2000", "WWE Royal Rumble 1992", "NJPW Wrestle Kingdom 13", "Impact Wrestling: Slammiversary 2022", "WCW Beach Blast",
"WWE SummerSlam 2013", "AEW x NJPW Presents Forbidden Door", "WWE SummerSlam 1992", "WCW Hog Wild 1996", "NWA Starrcade '86: The Night of The Sky-Walkers",
"WWE WrestleMania XX", "ECW Heat Wave 1998", "WWE WrestleMania X", "WCW Starrcade 1993", "AEW Revolution 2021", "ROH: Final Battle (2021)",
"WWE WrestleMania X-Seven", "ECW Guilty as Charged 1999", "WWE In Your House 16: Canadian Stampede", "NJPW Dominion 6.9 in Osaka-jo Hall",
"IMPACT Wrestling: Bound for Glory 2019", "WCW Bash at the Beach 1996", "WWE WrestleMania XV", "NWA Chi-Town Rumble", "AEW Full Gear (2021)",
"WWE Survivor Series 1997", "ECW November To Remember 1998", "WCW Spring Stampede 1994", "WWE King of the Ring 1998")
@@ -3,7 +3,11 @@ package tv.orbit.classic
/** Local hours, wrapping past midnight, and the titles a channel may use then. No titles means everything in its pool. */
internal data class DayPart(val fromHour: Int, val toHour: Int, val titles: List<String> = emptyList(), val group: String = "",
/** Set for an event: only these days, starting from its [fromHour] on each. List it before the everyday blocks. */
val days: Set<java.time.DayOfWeek> = emptySet()) {
val days: Set<java.time.DayOfWeek> = emptySet(),
/** An appointment: the programmes before it are chosen, where one fits, to finish by its hour, so it starts on time. */
val onTime: Boolean = false,
/** One start a night: once a programme from this event has started, the rest of its window goes to the usual block. */
val once: Boolean = 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)
@@ -25,12 +29,14 @@ internal data class ChannelProgramming(val number: Int, val name: String, val se
val shuffleEpisodes: Boolean = false,
/** Shows played in a mixed order on a channel that otherwise runs in season order, such as Paradox's standalone adventures. */
val shuffleTitles: Set<String> = emptySet(),
/** Films a series channel may carry, each only in an event that names it. Empty everywhere but Ring X. */
val channelFilms: List<String> = emptyList(),
/** Series a film channel may carry, each only in an event that names it, one whole episode a night in order. Empty everywhere but After Dark. */
val filmSeries: List<String> = emptyList()) {
/** Whether a show plays its episodes in a mixed order here. */
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("|")}"
val signature get() = "$CHANNEL_POOL_VERSION#${searches.joinToString("|")}#$seriesCount" + if (filmSeries.isEmpty()) "" else "#series:${filmSeries.joinToString("|")}" + if (channelFilms.isEmpty()) "" else "#films:${channelFilms.joinToString("|")}"
}
/** Expect the unexpected: standalone adventures by day in a mixed order, cult drama in order in prime time, and the strange stuff late. */
@@ -79,7 +85,8 @@ internal val SmartChannels = listOf(
ChannelProgramming(106, "Paradox", ParadoxShows, seriesCount = 20, finishTogether = true, exactTitles = true, dayParts = ParadoxDayParts, shuffleTitles = ParadoxStandalones.toSet())) +
ChannelPresets.filter { it.smartOnly }.map { ChannelProgramming(it.number, it.name, it.searches, seriesCount = if (it.films) it.searches.size else 60, finishTogether = !it.films, exactTitles = true,
filmRestMs = if (it.films) 7 * 24 * 60 * 60_000L else null,
suggestionRules = SmartChannelRules[it.number].orEmpty(), dayParts = SmartChannelParts[it.number].orEmpty(), shuffleTitles = SmartChannelMixed[it.number].orEmpty()) }
suggestionRules = SmartChannelRules[it.number].orEmpty(), dayParts = SmartChannelParts[it.number].orEmpty(), shuffleTitles = SmartChannelMixed[it.number].orEmpty(),
channelFilms = if (it.number == 401) PpvSunday else emptyList()) }
/** Shows that play in a mixed order on channels whose identity is agreed. See ChannelIdentities.kt. */
private val SmartChannelMixed: Map<Int, Set<String>> get() = mapOf(101 to Orbit1Mixed, 102 to Orbit2Mixed, 103 to ThreeMixed, 104 to GoldMixed, 105 to RiotMixed,
@@ -159,20 +166,24 @@ internal fun dayPartPool(pool: List<PoolSeries>, parts: List<DayPart>, startMs:
dayPartChoice(pool, parts, startMs, zone).first
/** [dayPartPool], with a short name for the block it came from, for the reasons kept with each programme. */
internal fun dayPartChoice(pool: List<PoolSeries>, parts: List<DayPart>, startMs: Long, zone: java.time.ZoneId): Pair<List<PoolSeries>, String> {
internal fun dayPartChoice(pool: List<PoolSeries>, parts: List<DayPart>, startMs: Long, zone: java.time.ZoneId): Pair<List<PoolSeries>, String> =
dayPartFor(pool, parts, startMs, zone).let { it.first to it.second }
/** [dayPartChoice], with the part it came from, or null for the whole pool. */
internal fun dayPartFor(pool: List<PoolSeries>, parts: List<DayPart>, startMs: Long, zone: java.time.ZoneId): Triple<List<PoolSeries>, String, DayPart?> {
val local = java.time.Instant.ofEpochMilli(startMs).atZone(zone)
// An event with nothing to show gives way to the ordinary block for that time.
for (part in parts.filter { it.covers(local.hour, local.dayOfWeek) }) {
val name = (if (part.days.isNotEmpty()) "event " else "block ") + part.group.ifEmpty { "${part.fromHour}-${part.toHour}" }
if (part.titles.isEmpty() && part.group.isEmpty()) return pool to name
if (part.titles.isEmpty() && part.group.isEmpty()) return Triple(pool, name, part)
val titles = part.titles.map(::seriesKey).toSet()
// A film is named with its year, as "Halloween (1978)"; the pool already holds that exact film under its plain title.
val films = part.titles.map { seriesKey(FilmIdentity.of(it).title) }.toSet()
val allowed = pool.filter { seriesKey(it.title) in titles || (it.isFilm && seriesKey(it.title) in films) || (part.group.isNotEmpty() && it.group == part.group) }
if (allowed.isNotEmpty()) return allowed to name
if (allowed.isNotEmpty()) return Triple(allowed, name, part)
}
// A film saved for an event doesn't appear in everyday programming.
return pool.filter { !it.isFilm || pool.all(PoolSeries::isFilm) }.ifEmpty { pool } to (if (parts.isEmpty()) "whole pool" else "no block, whole pool")
return Triple(pool.filter { !it.isFilm || pool.all(PoolSeries::isFilm) }.ifEmpty { pool }, if (parts.isEmpty()) "whole pool" else "no block, whole pool", null)
}
/** A few names and how many more, so a reason stays short. */
@@ -262,6 +273,16 @@ internal fun extendFilmSchedule(pool: List<PoolSeries>, cursor: ScheduleCursor,
return ChannelPlan(entries, ScheduleCursor(last, marks, shown))
}
/** A one-a-night event counts as having had its turn for this long after a programme from it starts. */
private const val ONCE_A_NIGHT_MS = 12 * 60 * 60_000L
/** How far ahead an on-time appointment is looked for, and how late after its hour it may start. */
private const val ON_TIME_LOOKAHEAD_HOURS = 4
private const val ON_TIME_GRACE_MS = 20 * 60_000L
/** An appointment's window is its first hour; a programme must end inside it for the appointment to happen at all. */
private const val ON_TIME_LAST_CALL_MS = 60 * 60_000L
/** How long before an appointment the programmes leading into it may be adjusted. */
private const val ON_TIME_RUN_IN_MS = 90 * 60_000L
/** A series on a film channel airs at most once in this long, so a long event window still holds one episode. */
private const val SERIES_NIGHT_MS = 12 * 60 * 60_000L
@@ -286,6 +307,25 @@ internal fun extendSchedule(pool: List<PoolSeries>, cursor: ScheduleCursor, from
// How many times in a row the last show has played, counted from the start of this extension.
var run = if (cursor.lastSeriesId != null) runBefore else 0
val blockLast = cursor.blockLast.toMutableMap()
// When each film last started, kept so a one-a-night event can tell it has had its turn.
val shown = cursor.filmShown.toMutableMap()
fun hadItsTurn(available: List<PoolSeries>, at: Long) = available.any { film -> film.isFilm && shown[film.id]?.let { at - it < ONCE_A_NIGHT_MS } == true }
/** The part for [at], passing over a one-a-night event that has already started a programme tonight. */
fun partAt(at: Long): Triple<List<PoolSeries>, String, DayPart?> {
val first = dayPartFor(pool, dayParts, at, zone)
val part = first.third ?: return first
return if (part.once && hadItsTurn(first.first, at)) dayPartFor(pool, dayParts - part, at, zone) else first
}
/** The next on-time appointment within a few hours, if there is one and it hasn't had its turn tonight. */
fun appointmentAfter(at: Long): Long? {
val hour = 60 * 60_000L
val local = java.time.Instant.ofEpochMilli(at).atZone(zone)
val nextHour = local.truncatedTo(java.time.temporal.ChronoUnit.HOURS).plusHours(1).toInstant().toEpochMilli()
return (0 until ON_TIME_LOOKAHEAD_HOURS).map { nextHour + it * hour }.firstOrNull { boundary ->
val (films, _, part) = partAt(boundary)
part?.onTime == true && films.isNotEmpty()
}
}
fun isMixed(show: PoolSeries) = shuffle || mixed(show)
fun running(show: PoolSeries) = if (isMixed(show)) mixes.getOrPut(show.id) { shuffledEpisodes(show) } else show.episodes
fun following(show: PoolSeries): PoolEpisode {
@@ -294,7 +334,7 @@ internal fun extendSchedule(pool: List<PoolSeries>, cursor: ScheduleCursor, from
return mix[(mix.indexOfFirst { it.mark == marks[show.id] } + 1) % mix.size]
}
while (start < untilMs) {
val (available, block) = dayPartChoice(pool, dayParts, start, zone)
val (available, block, part) = partAt(start)
// Shows only wait for others in the same block, or a daytime show could stand idle for an evening one.
val restarted = finishTogether && available.all { marks[it.id] == running(it).last().mark }
if (restarted) available.forEach { marks.remove(it.id) }
@@ -310,7 +350,27 @@ internal fun extendSchedule(pool: List<PoolSeries>, cursor: ScheduleCursor, from
else -> true
}
}
val chosen = picked ?: nextInTurn(pool, after, allowed)
var chosen = picked ?: nextInTurn(pool, after, allowed)
// Before an appointment, a show in turn that finishes in time goes first, so the appointment starts near its hour. Nothing is cut.
val appointment = if (part?.onTime == true) null else appointmentAfter(start)
var fitted = false
val latest = (appointment ?: 0L) + ON_TIME_GRACE_MS
fun ends(show: PoolSeries) = start + following(show).durationMs
val candidates = if (appointment == null) emptyList() else turnOrder(pool, after).filter { show -> allowed(show) && !avoid(show, start, ends(show)) }
/** Whether [show] leaves the appointment on time: ending in its first minutes, or leaving a gap another show closes. */
fun onTimeAfter(show: PoolSeries) = ends(show) in appointment!!..latest ||
(ends(show) < appointment && candidates.any { other -> other.id != show.id && ends(show) + following(other).durationMs in appointment..latest })
// Only the last stretch before the appointment is adjusted; earlier programmes keep their ordinary turns.
if (appointment != null && ends(chosen) > appointment - ON_TIME_RUN_IN_MS && !onTimeAfter(chosen)) {
val fits = candidates.filter { ends(it) <= latest }
// Best is a show ending right at the appointment; next, one that leaves a gap another show can close; then anything that fits.
val choice = fits.firstOrNull { ends(it) >= appointment }
?: fits.firstOrNull { onTimeAfter(it) }
?: fits.firstOrNull().takeIf { ends(chosen) > latest }
// Failing that, at least something that ends while the appointment's window is still open, so it isn't missed.
?: candidates.firstOrNull { ends(it) < appointment + ON_TIME_LAST_CALL_MS }.takeIf { ends(chosen) >= appointment + ON_TIME_LAST_CALL_MS }
if (choice != null) { chosen = choice; fitted = true }
}
// Never a third in a row while another show in the block is only waiting for the round to finish. That one starts its next round early.
val early = if (!noThirdInARow || !finishTogether || chosen.id != last || run < 2) null else turnOrder(pool, after).firstOrNull { show ->
show.id != chosen.id && show in available && marks[show.id] == running(show).last().mark && !avoid(show, start, start + running(show).first().durationMs)
@@ -326,6 +386,7 @@ internal fun extendSchedule(pool: List<PoolSeries>, cursor: ScheduleCursor, from
else -> "; fallback: every show in turn airs elsewhere then"
})
if (isMixed(series)) append(", episode from its shuffled order")
if (fitted) append("; chosen to finish before the appointment at ${java.time.Instant.ofEpochMilli(appointment!!).atZone(zone).toLocalTime()}")
if (restarted) append("; every show had finished, so all started again")
if (waiting.isNotEmpty()) append("; deferred until the rest finish: ${someOf(waiting)}")
if (elsewhere.isNotEmpty()) append("; deferred, airing elsewhere: ${someOf(elsewhere)}")
@@ -337,9 +398,10 @@ internal fun extendSchedule(pool: List<PoolSeries>, cursor: ScheduleCursor, from
run = if (series.id == last) run + 1 else 1
last = series.id
blockLast[block] = series.id
if (series.isFilm) shown[series.id] = start
start += episode.durationMs
}
return ChannelPlan(entries, ScheduleCursor(last, marks, blockLast = blockLast))
return ChannelPlan(entries, ScheduleCursor(last, marks, shown, blockLast))
}
internal fun scheduledItem(seriesTitle: String, episode: PoolEpisode) = SampleItem(
@@ -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.93.0\"")
connection.setRequestProperty("X-Emby-Authorization", "Emby Client=\"Orbit TV\", Device=\"Orbit TV\", DeviceId=\"$deviceId\", Version=\"0.94.0\"")
request.token?.let { connection.setRequestProperty("X-Emby-Token", it) }
if (request.method == "POST") {
val bytes = request.body.orEmpty().toByteArray(Charsets.UTF_8)
@@ -257,6 +257,15 @@ internal class EmbySampleSession(private val transport: EmbyTransport, private v
if (copies.size > 1) android.util.Log.i("OrbitSchedule", "channel=${programming.number} copies=${copies.size} usedCopy=${read.indexOf(best) + 1} episodes=${read.map { it.episodes.size }}")
pool += best
}
// Films this series channel carries in an event, found exactly as a film channel finds them. Nothing stands in for one that isn't there.
if (programming.filmRestMs == null) for (entry in programming.channelFilms) {
checkActive()
requests++
val lookup = findFilm(transport, userId, ::currentToken, entry, BoxDecoders::canDecode)
if (lookup.note.isNotEmpty()) android.util.Log.i("OrbitSchedule", "channel=${programming.number} ${lookup.note}")
val film = lookup.film ?: continue
if (pool.none { it.id == film.id }) pool += film
}
for (accepted in choices.accepted) {
checkActive()
if (pool.any { it.id == accepted.id || seriesKey(it.title) == seriesKey(accepted.title) }) continue
@@ -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.93.0")
next.setRequestProperty("User-Agent", "OrbitTV/0.94.0")
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,90 @@
package tv.orbit.classic
import org.json.JSONArray
import org.junit.Assert.*
import org.junit.Test
import java.time.DayOfWeek
import java.time.ZoneId
import java.time.ZonedDateTime
/** Ring X's PPV Sunday: one curated event each Sunday near 19:00, run to its end, every event once before any repeats. */
class PpvSundayTest {
private val zone = ZoneId.of("Europe/London")
private val minute = 60_000L
private val week = 7 * 24 * 60 * minute
private val monday = ZonedDateTime.of(2026, 11, 9, 0, 0, 0, 0, zone).toInstant().toEpochMilli()
private val ringX = SmartChannels.first { it.number == 401 }
private fun show(title: String, count: Int, minutes: Long) = PoolSeries("s" + title.hashCode().toUInt(), title, (1..count).map {
PoolEpisode("e${title.hashCode().toUInt()}-$it", "src", EpisodeMark(1, it), "E$it", (minutes + it % 3) * minute) })
private fun event(i: Int, title: String, minutes: Long) = PoolSeries("ppv$i", FilmIdentity.of(title).title, listOf(PoolEpisode("ppv$i", "src$i", EpisodeMark(1, 1), title, minutes * minute)))
// Ring X's real show names with typical lengths, and the 52 events with their catalogue runtimes.
private val shows = listOf(show("WWE Raw", 300, 96), show("WCW Monday Nitro", 200, 100), show("IMPACT! Wrestling", 300, 86), show("All Elite Wrestling: Dynamite", 200, 113),
show("WWE SmackDown", 300, 84), show("WCW Thunder", 150, 86), show("ECW Hardcore TV", 300, 50), show("Ring of Honor (2002) [imdb-] [tvdb-386985]", 150, 60),
show("WWF Prime Time Wrestling", 195, 90), show("WWE Heat", 300, 45), show("WCW Clash of the Champions", 35, 90), show("WCW Saturday Night", 300, 84),
show("WWE Main Event", 300, 45), show("WWE NXT", 300, 59), show("Hulk Hogan's Rock 'n' Wrestling", 26, 22), show("Dark Side of the Ring", 69, 44), show("WWE Rivals", 42, 45))
private val library = JSONArray(javaClass.classLoader!!.getResource("ppv-sunday-library.json")!!.readText())
private val events = PpvSunday.mapIndexed { i, entry ->
val runtime = library.getJSONObject(i).getJSONArray("library").let { l -> (0 until l.length()).map { l.getJSONObject(it) } }
.first { FilmIdentity.of(entry).year == null || it.optInt("year") == FilmIdentity.of(entry).year }.getLong("ms") / minute
event(i, entry, runtime.coerceAtLeast(60))
}
private fun plan(pool: List<PoolSeries>, cursor: ScheduleCursor = ScheduleCursor(), from: Long = monday, until: Long = monday + 8 * week) =
extendSchedule(pool, cursor, from, until, finishTogether = true, dayParts = ringX.dayParts, zone = zone)
private fun local(ms: Long) = java.time.Instant.ofEpochMilli(ms).atZone(zone)
@Test fun everyEventResolvesToItsExactIdentityInTheLibrary() {
assertEquals(52, PpvSunday.size)
assertEquals(52, PpvSunday.map { seriesKey(FilmIdentity.of(it).title) to FilmIdentity.of(it).year }.distinct().size)
for (i in 0 until library.length()) {
val row = library.getJSONObject(i)
val candidates = row.getJSONArray("library").let { l -> (0 until l.length()).map { l.getJSONObject(it) } }.map {
FilmCandidate(it.getString("id"), it.getString("name"), it.optInt("year").takeIf { y -> y > 0 }, it.optString("imdb").takeIf { s -> s.startsWith("tt") },
listOf(org.json.JSONObject().put("Id", "src" + it.getString("id")).put("Container", "mkv")), 120 * minute * 10_000)
}
val found = resolveFilm(FilmIdentity.of(row.getString("entry")), candidates)
assertNotNull(row.getString("entry") + ": " + found.note, found.film)
if (!row.isNull("imdb")) assertEquals(row.getString("entry"), row.getString("imdb"), candidates.first { it.id == found.film!!.id }.imdb)
}
}
@Test fun oneEventEachSundayNearSevenRunToItsEnd() {
val result = plan(shows + events)
val ppv = result.entries.filter { it.seriesId.startsWith("ppv") }
assertEquals(8, ppv.size)
ppv.forEach { e ->
val t = local(e.startMs)
assertEquals(DayOfWeek.SUNDAY, t.dayOfWeek)
assertTrue("starts near 19:00: $t", t.hour == 19 && t.minute <= 20)
assertEquals(events.first { it.id == e.seriesId }.episodes.first().durationMs, e.media.durationMs)
}
assertTrue(result.entries.zipWithNext().all { (a, b) -> a.endMs == b.startMs })
}
@Test fun eventsRotateInListOrderAcrossRestarts() {
val first = plan(shows + events, until = monday + 3 * week)
val store = ScheduleStore(kotlin.io.path.createTempDirectory().toFile())
store.savePlan("u", 401, first)
val again = plan(shows + events, store.loadPlan("u", 401)!!.tail, from = first.endMs, until = first.endMs + 3 * week)
val aired = (first.entries + again.entries).filter { it.seriesId.startsWith("ppv") }.map { it.seriesId.removePrefix("ppv").toInt() }
assertEquals((0 until aired.size).toList(), aired)
}
@Test fun noEventsMeansAnOrdinarySundayWithNoGap() {
val result = plan(shows)
assertTrue(result.entries.zipWithNext().all { (a, b) -> a.endMs == b.startMs })
assertTrue(result.entries.none { it.media.item.type == "Movie" })
}
@Test fun eventsNeverAirOutsideTheirSundayWindow() {
plan(shows + events).entries.filter { it.seriesId.startsWith("ppv") }.forEach { assertEquals(19, local(it.startMs).hour) }
}
@Test fun theShowThatFitsIsNotAlwaysTheSameOne() {
val before = plan(shows + events).entries.filter { "chosen to finish before" in it.why }.map { it.seriesId }
assertTrue("fitted shows: $before", before.distinct().size > 1)
}
@Test fun onlyRingXCarriesFilmsInAnEvent() {
assertEquals(listOf(401), SmartChannels.filter { it.channelFilms.isNotEmpty() }.map { it.number })
}
}
File diff suppressed because one or more lines are too long
+21
View File
@@ -0,0 +1,21 @@
# Orbit TV 0.94.0: PPV Sunday on Ring X
A separate, Ring X-only capability. No other channel changes.
## What changed
- ChannelProgramming.channelFilms: films a series channel carries in an event, read with the exact film matcher from 0.90.0 (title, year, IMDb ID). Only Ring X has any. Missing or unplayable events are logged ("film=...") and skipped, never substituted.
- Two opt-in DayPart flags, used only by PPV Sunday: `once` (one programme starts from the event a night; afterwards the window goes to the usual block) and `onTime` (in the last 90 minutes before the appointment, the next show in turn that leaves it on time goes first: ending between 19:00 and 19:20, or leaving a gap another show closes; failing that, something that ends inside the event's hour so the night isn't missed). Nothing is cut and committed plans are untouched.
- A series channel's plan now keeps the start times of the films it plays (filmShown), so "once" survives restarts. Series-only channels are unaffected.
- The event: Sunday 19:00 to 20:00, one event, running to its natural end. Every event airs once before any repeats (the existing finish-together rotation, in list order), saved in the channel's cursor.
## The list
52 events (docs/briefs/ppv-sunday-list-2026-11-03.json): 18 WWF/WWE, 9 WCW, 7 ECW, 6 AEW, 4 NWA, 3 NJPW, 3 TNA/Impact, 2 ROH, spaced evenly by promotion, with older and newer events alternating within each promotion, never the same promotion two Sundays running. All 52 resolve to exactly one event in the catalogue, with the IMDb ID matching where the library has one (PpvSundayTest). Playability is checked by the box when it first reads the list; any event that doesn't play is skipped and reported for a replacement.
## Tests and replay
- PpvSundayTest: identities of all 52; one event each Sunday starting 19:00 to 19:20 and played whole; list-order rotation across a save and reload; no events means an ordinary Sunday with no gap; events never outside their window; the shows fitted before the event vary; only Ring X carries films. All 358 tests pass, including the unchanged plan fingerprints. Lint passed.
- Twelve weeks from the box's real files (Ring X's real shows) with the events at their catalogue runtimes: committed plans unchanged, no gaps, no fallbacks; 11 PPVs, one each Sunday after the booked week, in list order, no repeats. Ten started between 19:02 and 19:18; one at 19:38, when no show in turn could close the gap. Events ran to their natural ends, the latest finishing at 00:52 (NJPW Wrestle Kingdom 11). Shows chosen to lead in varied: WWE Main Event three times, Heat, Prime Time Wrestling, Clash of the Champions and ECW Hardcore TV once each.
## Rollback
Remove PpvSunday from Ring X's channelFilms (and the event); Sunday evening returns to the vault. Nothing else depends on it.
Not installed.
+159 -159
View File
@@ -25,9 +25,9 @@
},
{
"promotion": "WWE",
"entry": "WWE Survivor Series 1987",
"runtime": 168,
"imdb": "tt0259008"
"entry": "WWE WrestleMania 39 Sunday",
"runtime": 222,
"imdb": "tt13865156"
},
{
"promotion": "NWA",
@@ -36,12 +36,54 @@
"imdb": "tt0324069"
},
{
"promotion": "WWE",
"entry": "WWE Survivor Series 1987",
"runtime": 168,
"imdb": "tt0259008"
},
{
"promotion": "NJPW",
"entry": "NJPW Wrestle Kingdom 11",
"runtime": 350,
"imdb": "tt6311836"
},
{
"promotion": "TNA",
"entry": "TNA Unbreakable 2005",
"runtime": 171,
"imdb": "tt0480019"
},
{
"promotion": "WCW",
"entry": "WCW Fall Brawl 1997",
"runtime": 163,
"imdb": "tt1641647"
},
{
"promotion": "WWE",
"entry": "WWE Royal Rumble 2022",
"runtime": 228,
"imdb": "tt15541468"
},
{
"promotion": "ECW",
"entry": "ECW One Night Stand 2005",
"runtime": 152,
"imdb": "tt0451465"
},
{
"promotion": "AEW",
"entry": "AEW: All In 2023",
"runtime": 238,
"imdb": "tt27442822"
},
{
"promotion": "ROH",
"entry": "ROH: Supercard of Honor XII",
"runtime": 273,
"imdb": "516828"
},
{
"promotion": "WWE",
"entry": "WWE SummerSlam 1988",
"runtime": 150,
@@ -54,10 +96,10 @@
"imdb": "tt1252413"
},
{
"promotion": "TNA",
"entry": "TNA Unbreakable 2005",
"runtime": 171,
"imdb": "tt0480019"
"promotion": "WWE",
"entry": "WWE Evolution (2018)",
"runtime": 196,
"imdb": "tt8948190"
},
{
"promotion": "ECW",
@@ -72,10 +114,16 @@
"imdb": "tt0252103"
},
{
"promotion": "ROH",
"entry": "ROH: Supercard of Honor XII",
"runtime": 273,
"imdb": "516828"
"promotion": "NWA",
"entry": "NWA WrestleWar '89: The Music City Showdown",
"runtime": 148,
"imdb": "tt1535497"
},
{
"promotion": "WCW",
"entry": "WCW World War 3 1996",
"runtime": 165,
"imdb": "tt2540040"
},
{
"promotion": "AEW",
@@ -85,27 +133,51 @@
},
{
"promotion": "WWE",
"entry": "WWE WrestleMania XXX",
"runtime": 234,
"imdb": "tt3058844"
},
{
"promotion": "ECW",
"entry": "ECW Anarchy Rulz 2000",
"runtime": 144,
"imdb": "tt2572368"
},
{
"promotion": "WWE",
"entry": "WWE Royal Rumble 1992",
"runtime": 159,
"imdb": "tt0261253"
},
{
"promotion": "NJPW",
"entry": "NJPW Wrestle Kingdom 13",
"runtime": 312,
"imdb": "tt9436824"
},
{
"promotion": "TNA",
"entry": "Impact Wrestling: Slammiversary 2022",
"runtime": 171,
"imdb": "987047"
},
{
"promotion": "WCW",
"entry": "WCW Beach Blast",
"runtime": 169,
"imdb": "tt0326376"
},
{
"promotion": "ECW",
"entry": "ECW Heat Wave 1998",
"runtime": 159,
"imdb": "tt0308238"
"promotion": "WWE",
"entry": "WWE SummerSlam 2013",
"runtime": 167,
"imdb": "tt2846412"
},
{
"promotion": "AEW",
"entry": "AEW Revolution 2021",
"runtime": 222,
"imdb": "tt13424230"
"entry": "AEW x NJPW Presents Forbidden Door",
"runtime": 226,
"imdb": "tt19783536"
},
{
"promotion": "WWE",
@@ -114,16 +186,28 @@
"imdb": "tt0286998"
},
{
"promotion": "WCW",
"entry": "WCW Hog Wild 1996",
"runtime": 171,
"imdb": "tt0356693"
},
{
"promotion": "NWA",
"entry": "NWA Starrcade '86: The Night of The Sky-Walkers",
"runtime": 231,
"imdb": "tt0345959"
},
{
"promotion": "NJPW",
"entry": "NJPW Dominion 6.9 in Osaka-jo Hall",
"runtime": 339,
"imdb": "tt8537348"
"promotion": "WWE",
"entry": "WWE WrestleMania XX",
"runtime": 270,
"imdb": "tt0403687"
},
{
"promotion": "ECW",
"entry": "ECW Heat Wave 1998",
"runtime": 159,
"imdb": "tt0308238"
},
{
"promotion": "WWE",
@@ -138,16 +222,28 @@
"imdb": "tt0348118"
},
{
"promotion": "TNA",
"entry": "IMPACT Wrestling: Bound for Glory 2019",
"runtime": 175,
"imdb": "641361"
"promotion": "AEW",
"entry": "AEW Revolution 2021",
"runtime": 222,
"imdb": "tt13424230"
},
{
"promotion": "ROH",
"entry": "ROH: Final Battle (2021)",
"runtime": 182,
"imdb": "914321"
},
{
"promotion": "WWE",
"entry": "WWE WrestleMania X-Seven",
"runtime": 225,
"imdb": "tt0282267"
},
{
"promotion": "ECW",
"entry": "ECW November To Remember 1998",
"runtime": 153,
"imdb": "tt0371656"
"entry": "ECW Guilty as Charged 1999",
"runtime": 160,
"imdb": "tt2042509"
},
{
"promotion": "WWE",
@@ -156,10 +252,34 @@
"imdb": "tt0296925"
},
{
"promotion": "ROH",
"entry": "ROH: Final Battle (2021)",
"runtime": 182,
"imdb": "914321"
"promotion": "NJPW",
"entry": "NJPW Dominion 6.9 in Osaka-jo Hall",
"runtime": 339,
"imdb": "tt8537348"
},
{
"promotion": "TNA",
"entry": "IMPACT Wrestling: Bound for Glory 2019",
"runtime": 175,
"imdb": "641361"
},
{
"promotion": "WCW",
"entry": "WCW Bash at the Beach 1996",
"runtime": 165,
"imdb": "tt0311990"
},
{
"promotion": "WWE",
"entry": "WWE WrestleMania XV",
"runtime": 166,
"imdb": "tt0247826"
},
{
"promotion": "NWA",
"entry": "NWA Chi-Town Rumble",
"runtime": 149,
"imdb": "tt0926212"
},
{
"promotion": "AEW",
@@ -174,141 +294,21 @@
"imdb": "tt0264067"
},
{
"promotion": "ECW",
"entry": "ECW November To Remember 1998",
"runtime": 153,
"imdb": "tt0371656"
},
{
"promotion": "WCW",
"entry": "WCW Spring Stampede 1994",
"runtime": 169,
"imdb": "tt1508373"
},
{
"promotion": "ECW",
"entry": "ECW Guilty as Charged 1999",
"runtime": 160,
"imdb": "tt2042509"
},
{
"promotion": "AEW",
"entry": "AEW x NJPW Presents Forbidden Door",
"runtime": 226,
"imdb": "tt19783536"
},
{
"promotion": "WWE",
"entry": "WWE King of the Ring 1998",
"runtime": 159,
"imdb": "tt0311996"
},
{
"promotion": "NWA",
"entry": "NWA Chi-Town Rumble",
"runtime": 149,
"imdb": "tt0926212"
},
{
"promotion": "NJPW",
"entry": "NJPW Wrestle Kingdom 13",
"runtime": 312,
"imdb": "tt9436824"
},
{
"promotion": "WWE",
"entry": "WWE WrestleMania XV",
"runtime": 166,
"imdb": "tt0247826"
},
{
"promotion": "WCW",
"entry": "WCW Bash at the Beach 1996",
"runtime": 165,
"imdb": "tt0311990"
},
{
"promotion": "TNA",
"entry": "Impact Wrestling: Slammiversary 2022",
"runtime": 171,
"imdb": "987047"
},
{
"promotion": "ECW",
"entry": "ECW Anarchy Rulz 2000",
"runtime": 144,
"imdb": "tt2572368"
},
{
"promotion": "WWE",
"entry": "WWE WrestleMania X-Seven",
"runtime": 225,
"imdb": "tt0282267"
},
{
"promotion": "AEW",
"entry": "AEW: All In 2023",
"runtime": 238,
"imdb": "tt27442822"
},
{
"promotion": "WWE",
"entry": "WWE WrestleMania XX",
"runtime": 270,
"imdb": "tt0403687"
},
{
"promotion": "WCW",
"entry": "WCW Hog Wild 1996",
"runtime": 171,
"imdb": "tt0356693"
},
{
"promotion": "ECW",
"entry": "ECW One Night Stand 2005",
"runtime": 152,
"imdb": "tt0451465"
},
{
"promotion": "WWE",
"entry": "WWE SummerSlam 2013",
"runtime": 167,
"imdb": "tt2846412"
},
{
"promotion": "NWA",
"entry": "NWA WrestleWar '89: The Music City Showdown",
"runtime": 148,
"imdb": "tt1535497"
},
{
"promotion": "WWE",
"entry": "WWE WrestleMania XXX",
"runtime": 234,
"imdb": "tt3058844"
},
{
"promotion": "WCW",
"entry": "WCW World War 3 1996",
"runtime": 165,
"imdb": "tt2540040"
},
{
"promotion": "WWE",
"entry": "WWE Evolution (2018)",
"runtime": 196,
"imdb": "tt8948190"
},
{
"promotion": "WWE",
"entry": "WWE Royal Rumble 2022",
"runtime": 228,
"imdb": "tt15541468"
},
{
"promotion": "WCW",
"entry": "WCW Fall Brawl 1997",
"runtime": 163,
"imdb": "tt1641647"
},
{
"promotion": "WWE",
"entry": "WWE WrestleMania 39 Sunday",
"runtime": 222,
"imdb": "tt13865156"
}
]
+2
View File
@@ -19,3 +19,5 @@
**Order:** every show in its own episode order. No RAW-against-Nitro airdate pairing until the metadata is verified (programming bible).
**Library, 3 November 2026:** about 30 real wrestling series (the original list's guessed WWF, PPV and Attitude names mostly don't exist as series; they stay on the list in case they appear), and about 450 events stored as films (WWE 266, AEW 65, WCW 42, NJPW 38, ECW 26, TNA and Impact 33, ROH 11, NWA Starrcades), median 170 minutes, for PPV Sunday.
**PPV Sunday** (0.94.0): one classic event every Sunday from the 52 in `PpvSunday` (ChannelIdentities.kt), spaced so every part of the year mixes WWF/WWE, WCW, ECW, AEW, NWA, NJPW, TNA/Impact and ROH, never the same promotion two weeks running. Each event airs once before any repeats; the place is saved and survives restarts. The programmes before it are chosen, in their normal turn where possible, to finish so the event starts between 19:00 and 19:20; nothing is cut. Exactly one event starts each Sunday, and it runs to its natural end, past midnight if need be. Events are found by exact identity; one that can't be found or played is logged and skipped, never replaced, and Sunday stays the vault with no gap if none is available.