0.99.0: Ring X weeknight flagships are appointments, so they start near 18:00
pauljd/davidson-ci: Davidson CI / quality (push) Failing after 1m45s
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-04 01:00:29 +00:00
co-authored by Claude Opus 5.5
parent 837f97a3bf
commit e0d600bc3d
7 changed files with 159 additions and 7 deletions
@@ -350,10 +350,11 @@ private val RingXSaturday = listOf("Ring of Honor (2002) [imdb-] [tvdb-386985]",
private val RingXLate = listOf("Dark Side of the Ring", "The Monday Night War", "WWE Untold", "WWE Rivals", "Biography: WWE Legends", "WWE Icons", "WWE Ruthless Aggression",
"Who Killed WCW?", "The Wrestlers", "Wrestlers", "WWE Legends House", "WWE NXT")
internal val RingXShows get() = (RingXMonday + RingXTuesday + RingXWednesday + RingXThursday + RingXFriday + RingXSaturday + RingXDaytimeVault + RingXLate + RingXVault).distinct()
// The weeknight flagships are appointments (4 November 2026): the vault before 18:00 is chosen to finish in time, so the night starts near its hour.
internal val RingXDayParts get() = listOf(
DayPart(18, 23, RingXMonday, days = setOf(DayOfWeek.MONDAY), key = "ringx.monday"), DayPart(18, 23, RingXTuesday, days = setOf(DayOfWeek.TUESDAY), key = "ringx.tuesday"),
DayPart(18, 23, RingXWednesday, days = setOf(DayOfWeek.WEDNESDAY), key = "ringx.wednesday"), DayPart(18, 23, RingXThursday, days = setOf(DayOfWeek.THURSDAY), key = "ringx.thursday"),
DayPart(18, 23, RingXFriday, days = setOf(DayOfWeek.FRIDAY), key = "ringx.friday"), DayPart(18, 23, RingXSaturday, days = setOf(DayOfWeek.SATURDAY), key = "ringx.saturday"),
DayPart(18, 23, RingXMonday, days = setOf(DayOfWeek.MONDAY), onTime = true, key = "ringx.monday"), DayPart(18, 23, RingXTuesday, days = setOf(DayOfWeek.TUESDAY), onTime = true, key = "ringx.tuesday"),
DayPart(18, 23, RingXWednesday, days = setOf(DayOfWeek.WEDNESDAY), onTime = true, key = "ringx.wednesday"), DayPart(18, 23, RingXThursday, days = setOf(DayOfWeek.THURSDAY), onTime = true, key = "ringx.thursday"),
DayPart(18, 23, RingXFriday, days = setOf(DayOfWeek.FRIDAY), onTime = true, key = "ringx.friday"), DayPart(18, 23, RingXSaturday, days = setOf(DayOfWeek.SATURDAY), onTime = true, key = "ringx.saturday"),
// 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, key = "ringx.ppv"),
DayPart(6, 23, RingXDaytimeVault), DayPart(23, 6, RingXLate))
@@ -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.98.0\"")
connection.setRequestProperty("X-Emby-Authorization", "Emby Client=\"Orbit TV\", Device=\"Orbit TV\", DeviceId=\"$deviceId\", Version=\"0.99.0\"")
request.token?.let { connection.setRequestProperty("X-Emby-Token", it) }
if (request.method == "POST") {
val bytes = request.body.orEmpty().toByteArray(Charsets.UTF_8)
@@ -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.98.0")
next.setRequestProperty("User-Agent", "OrbitTV/0.99.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,36 @@
package tv.orbit.classic
import org.junit.Assert.assertEquals
import org.junit.Assert.assertTrue
import org.junit.Test
import java.time.DayOfWeek
class RingXWeeknightsTest {
private val zone = java.time.ZoneId.of("Europe/London")
private val day = 24 * 60 * 60_000L
private val ring get() = SmartChannels.first { it.number == 401 }
@Test fun theSixWeeknightsAreAppointmentsAndNothingElseChanged() {
val nights = ring.dayParts.filter { it.fromHour == 18 && it.toHour == 23 }
assertEquals(DayOfWeek.entries.filter { it != DayOfWeek.SUNDAY }.toSet(), nights.flatMap { it.days }.toSet())
assertTrue(nights.all { it.onTime && !it.once && it.key.startsWith("ringx.") })
val ppv = ring.dayParts.single { it.key == "ringx.ppv" }
assertTrue(ppv.onTime && ppv.once && ppv.fromHour == 19)
assertTrue(ring.dayParts.filter { it.days.isEmpty() }.none { it.onTime })
}
@Test fun theNightStartsNearItsHourWithNothingCut() {
// Vault episodes of awkward lengths, so the daytime never lands on 18:00 by itself.
fun show(title: String, minutes: Int) = PoolSeries(title, title, (1..300).map { PoolEpisode("$title-$it", "src", EpisodeMark(1, it), "E$it", minutes * 60_000L) })
val titles = ring.dayParts.flatMap { it.titles }.distinct()
val pool = titles.filter { it in listOf("WWF Prime Time Wrestling", "WWE Heat", "WCW Saturday Night", "WWE Raw", "WCW Monday Nitro", "IMPACT! Wrestling", "All Elite Wrestling: Dynamite",
"WWE SmackDown", "ECW Hardcore TV", "NJPW Strong", "Dark Side of the Ring", "WWE Untold") }.mapIndexed { i, t -> show(t, listOf(47, 89, 63, 41, 118, 52)[i % 6]) }
val start = java.time.LocalDate.of(2026, 11, 16).atStartOfDay(zone).toInstant().toEpochMilli()
val plan = extendSchedule(pool, ScheduleCursor(), start, start + 14 * day, finishTogether = true, dayParts = ring.dayParts, zone = zone)
plan.entries.zipWithNext().forEach { (a, b) -> assertEquals(a.endMs, b.startMs) }
val firsts = plan.entries.filter { "event 18-23" in it.why }.groupBy { java.time.Instant.ofEpochMilli(it.startMs).atZone(zone).toLocalDate() }
.map { (date, es) -> (es.minOf { it.startMs } - date.atTime(18, 0).atZone(zone).toInstant().toEpochMilli()) / 60_000 }
assertEquals(12, firsts.size)
assertTrue("late by $firsts", firsts.all { it in 0..20 })
}
}