diff --git a/android/app/src/household/java/tv/orbit/classic/InstallSnapshot.kt b/android/app/src/household/java/tv/orbit/classic/InstallSnapshot.kt index 264a5a7d..9b5cc400 100644 --- a/android/app/src/household/java/tv/orbit/classic/InstallSnapshot.kt +++ b/android/app/src/household/java/tv/orbit/classic/InstallSnapshot.kt @@ -23,7 +23,12 @@ import java.security.MessageDigest * - `approve-add` (23 November 2026): titles you approved outside the app, from install-restore/approve.json, added to their * channels' lists with `confirm ADD` while Orbit's screen isn't open. See [ApprovedTitles]: it only adds. * - * Apart from `restore` and `approve-add`, it only ever copies; it never changes the schedules, the library or the sign-in. + * - `fix-booking` (23 November 2026): one booking replaced by hand, from install-restore/fix.json, with `confirm FIX` while + * Orbit's screen isn't open. See [BookingFix]: nothing else in the plan moves. + * + * - `release-runtime` (23 November 2026): a film held for an odd running time, let through (`--es id`, `confirm RELEASE`). + * + * Apart from `restore`, `approve-add`, `fix-booking` and `release-runtime`, it only ever copies; it never changes the schedules, the library or the sign-in. */ class InstallSnapshotReceiver : BroadcastReceiver() { override fun onReceive(context: Context, intent: Intent) { @@ -60,6 +65,28 @@ class InstallSnapshotReceiver : BroadcastReceiver() { } catch (e: Exception) { resultData = "failed: ${e.javaClass.simpleName}" } finally { incoming.delete() } android.util.Log.i("OrbitInstall", "approve-add: $resultData") return + } else if (intent.getStringExtra("do") == "release-runtime") { + // A film held for an odd running time ([RuntimeReview]) that you've looked at: booked as normal from now on. + val target = Workspaces.current(context) + resultData = if (intent.getStringExtra("confirm") != "RELEASE") "refused: needs confirm RELEASE" + else ScheduleStore(target.scheduleDir).runtimeReleases().add(intent.getStringExtra("id").orEmpty()) + android.util.Log.i("OrbitInstall", "release-runtime: $resultData") + return + } else if (intent.getStringExtra("do") == "fix-booking") { + // One booking replaced by hand ([BookingFix]): adb pushes install-restore/fix.json; it's read once and removed. + val incoming = File(context.getExternalFilesDir(null), "install-restore/fix.json") + try { + val target = Workspaces.current(context) + resultData = when { + intent.getStringExtra("confirm") != "FIX" -> "refused: needs confirm FIX" + OrbitScreen.open -> "refused: Orbit is open; force-stop it first" + !incoming.exists() -> "refused: no fix.json" + else -> ServerMove.userOf(target.scheduleDir)?.let { user -> + BookingFix.apply(target.scheduleDir, user, org.json.JSONObject(incoming.readText()), System.currentTimeMillis()) } ?: "refused: no saved schedules" + } + } catch (e: Exception) { resultData = "failed: ${e.javaClass.simpleName}" } finally { incoming.delete() } + android.util.Log.i("OrbitInstall", "fix-booking: $resultData") + return } else if (intent.getStringExtra("do").orEmpty().startsWith("move-")) { // Reading two catalogues takes a few seconds: off the main thread, answered when done. val pending = goAsync() diff --git a/android/app/src/main/java/tv/orbit/classic/BookingFix.kt b/android/app/src/main/java/tv/orbit/classic/BookingFix.kt new file mode 100644 index 00000000..9d741e6c --- /dev/null +++ b/android/app/src/main/java/tv/orbit/classic/BookingFix.kt @@ -0,0 +1,65 @@ +package tv.orbit.classic + +import org.json.JSONArray +import org.json.JSONObject +import java.io.File + +/** + * One booking replaced by hand (Paul, 23 November 2026: Mistletoe's "Coming Home for Christmas" was a 10-hour file, booked at + * 23:21). The films named take its place, back to back, and the last one's slot runs to where the bad booking ended, the + * channel's ident filling the few minutes left as it does after any short file. Nothing else in the plan moves. + * + * - only a booking that hasn't started, found by its start and its item, is replaced; + * - each replacement is a film in the channel's own pool, named once, and not the file being replaced; + * - together they fill the slot to within [MAX_LEFTOVER_MS], without running past it; + * - the plan file is kept as it was in fix-