From 805f75f9c0cedf41270325d991efe03902b6f3c7 Mon Sep 17 00:00:00 2001 From: Pauljd Date: Sun, 15 Nov 2026 07:53:07 +0000 Subject: [PATCH] Own server: the catalogue read in five nights, not 23; the Chair's learning label follows the press (1.0 RC3-7, build 49) Paul, 15 November 2026. With 'This is my server' on, the overnight catalogue read takes 25 pages an hour, two minutes apart (25,000 titles a night), from 5. The learning switch showed its new state only after the report was worked out again, so a second press looked needed and turned learning back off; the label now changes at once. Co-Authored-By: Claude Opus 5.5 --- android/app/build.gradle.kts | 2 +- .../main/java/tv/orbit/classic/ChannelScheduler.kt | 12 ++++++++++-- .../src/main/java/tv/orbit/classic/DirectorChair.kt | 8 ++++++-- .../java/tv/orbit/classic/EmbyConnectionScreen.kt | 2 +- .../test/java/tv/orbit/classic/SafetyLimitsTest.kt | 3 +++ 5 files changed, 21 insertions(+), 6 deletions(-) diff --git a/android/app/build.gradle.kts b/android/app/build.gradle.kts index bd787fe3..2c4f3e7e 100644 --- a/android/app/build.gradle.kts +++ b/android/app/build.gradle.kts @@ -3,7 +3,7 @@ plugins { id("org.jetbrains.kotlin.plugin.compose") } /** The release's build number: versionCode is this x 10 plus the edition's channel. */ -val ORBIT_BUILD = 48 +val ORBIT_BUILD = 49 android { namespace = "tv.orbit.classic" compileSdk = 36 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 8ea8e733..58471bf9 100644 --- a/android/app/src/main/java/tv/orbit/classic/ChannelScheduler.kt +++ b/android/app/src/main/java/tv/orbit/classic/ChannelScheduler.kt @@ -111,11 +111,16 @@ internal class ChannelScheduler(private val store: ScheduleStore, * take four months). Between 01:00 and 06:00, five pages of 200 an hour, six minutes apart: 5,000 titles a night, and * nothing while people are likely to be watching. The daytime refresh carries on as before; once the read is whole this * does nothing. + * + * On the household's own server ([ownServer], 15 November 2026: the capacity test showed no strain up to ~126 requests a + * minute) it reads five times as much, 25 pages an hour two minutes apart: 25,000 titles a night, a 115,000-title library + * in five nights rather than 23. */ - fun overnightCatalogue(session: EmbySampleSession, userId: String, catalogue: CatalogueStore, nowMs: Long = clock(), pause: () -> Unit = { Thread.sleep(OVERNIGHT_PAGE_GAP_MS) }) { + fun overnightCatalogue(session: EmbySampleSession, userId: String, catalogue: CatalogueStore, nowMs: Long = clock(), ownServer: Boolean = false, + pause: () -> Unit = { Thread.sleep(if (ownServer) OWN_SERVER_PAGE_GAP_MS else OVERNIGHT_PAGE_GAP_MS) }) { val hour = java.time.Instant.ofEpochMilli(nowMs).atZone(java.time.ZoneId.systemDefault()).hour if (hour !in OVERNIGHT_HOURS || catalogue.complete()) return - val run = session.importCatalogue(catalogue, OVERNIGHT_PAGES_PER_HOUR, pause = pause) + val run = session.importCatalogue(catalogue, if (ownServer) OWN_SERVER_PAGES_PER_HOUR else OVERNIGHT_PAGES_PER_HOUR, pause = pause) Log.i("OrbitSchedule", "overnight catalogue pages=${run.pages} read=${run.records} finished=${run.finished}") } @@ -434,3 +439,6 @@ internal object SeriesInspection { internal val OVERNIGHT_HOURS = 1..5 internal const val OVERNIGHT_PAGES_PER_HOUR = 5 internal const val OVERNIGHT_PAGE_GAP_MS = 6 * 60_000L +/** On the household's own server: see [ChannelScheduler.overnightCatalogue]. */ +internal const val OWN_SERVER_PAGES_PER_HOUR = 25 +internal const val OWN_SERVER_PAGE_GAP_MS = 2 * 60_000L diff --git a/android/app/src/main/java/tv/orbit/classic/DirectorChair.kt b/android/app/src/main/java/tv/orbit/classic/DirectorChair.kt index 317cc1da..127256d1 100644 --- a/android/app/src/main/java/tv/orbit/classic/DirectorChair.kt +++ b/android/app/src/main/java/tv/orbit/classic/DirectorChair.kt @@ -425,10 +425,14 @@ internal fun DirectorChair(load: (DirectorMode) -> DeskReport?, first: FocusRequ Spacer(Modifier.width(8.dp)) Text("Auto-approval: OFF", color = ChairMint, fontSize = 11.sp, fontWeight = FontWeight.SemiBold) Spacer(Modifier.width(8.dp)) - val learningOn = report?.learningOn == true + // The label follows the press at once (15 November 2026: it waited for the report to be worked out again, so a + // second press looked needed and turned learning straight back off). + var pressed by remember { mutableStateOf(null) } + LaunchedEffect(report?.learningOn) { if (report?.learningOn == pressed) pressed = null } + val learningOn = pressed ?: (report?.learningOn == true) var learnFocused by remember { mutableStateOf(false) } Text("Learning: " + if (learningOn) "ON" else "OFF", Modifier.onFocusChanged { learnFocused = it.isFocused } - .clickable { scope.launch { setLearning(!learningOn); said = if (learningOn) "Learning off: suggestions come from the channel briefs alone." else "Learning on: what it's learned from your decisions now shapes the suggestions."; version++ } } + .clickable { pressed = !learningOn; scope.launch { setLearning(!learningOn); said = if (learningOn) "Learning off: suggestions come from the channel briefs alone." else "Learning on: what it's learned from your decisions now shapes the suggestions."; version++ } } .background(if (learningOn) ChairMint else ChairPanel, RoundedCornerShape(12.dp)).border(if (learnFocused) 2.dp else 0.dp, Ink, RoundedCornerShape(12.dp)) .padding(horizontal = 10.dp, vertical = 3.dp), color = if (learningOn) ChairOnGold else Ink, fontSize = 11.sp, fontWeight = FontWeight.SemiBold) } diff --git a/android/app/src/main/java/tv/orbit/classic/EmbyConnectionScreen.kt b/android/app/src/main/java/tv/orbit/classic/EmbyConnectionScreen.kt index 4488a137..343fe181 100644 --- a/android/app/src/main/java/tv/orbit/classic/EmbyConnectionScreen.kt +++ b/android/app/src/main/java/tv/orbit/classic/EmbyConnectionScreen.kt @@ -468,7 +468,7 @@ internal fun EmbyConnectionScreen(modifier: Modifier = Modifier, visible: Boolea directorReports(scheduleStore, catalogue, active.accountId) } } } catch (cancelled: CancellationException) { throw cancelled } catch (failure: Exception) { android.util.Log.w("OrbitSchedule", "evidence failed=${failure.javaClass.simpleName}") } - if (!quiet) try { withContext(Dispatchers.IO) { BackgroundPacing.run { scheduler.overnightCatalogue(active, active.accountId, catalogue) } } } + if (!quiet) try { withContext(Dispatchers.IO) { BackgroundPacing.run { scheduler.overnightCatalogue(active, active.accountId, catalogue, ownServer = workspace.ownServer) } } } catch (cancelled: CancellationException) { throw cancelled } catch (failure: Exception) { android.util.Log.w("OrbitSchedule", "overnight catalogue failed=${failure.javaClass.simpleName}") } try { withContext(Dispatchers.IO) { BackgroundPacing.run { scheduler.refreshArrivals(active, active.accountId, catalogue) } } } diff --git a/android/app/src/test/java/tv/orbit/classic/SafetyLimitsTest.kt b/android/app/src/test/java/tv/orbit/classic/SafetyLimitsTest.kt index e8dfb7e1..9edc0a6c 100644 --- a/android/app/src/test/java/tv/orbit/classic/SafetyLimitsTest.kt +++ b/android/app/src/test/java/tv/orbit/classic/SafetyLimitsTest.kt @@ -76,6 +76,9 @@ class SafetyLimitsTest { @Test fun theOvernightReadOnlyRunsInTheSmallHours() { assertEquals(1..5, OVERNIGHT_HOURS) assertEquals(5_000, OVERNIGHT_HOURS.count() * OVERNIGHT_PAGES_PER_HOUR * CATALOGUE_PAGE_SIZE) + // The household's own server: 25,000 a night, still inside an hour each night. + assertEquals(25_000, OVERNIGHT_HOURS.count() * OWN_SERVER_PAGES_PER_HOUR * CATALOGUE_PAGE_SIZE) + assertTrue(OWN_SERVER_PAGES_PER_HOUR * OWN_SERVER_PAGE_GAP_MS <= 60 * 60_000L) } @Test fun ownServerSkipsTheQuietWeek() {