1.0 RC1: functional reliability
release-gate / verify (push) Successful in 9m41s
pauljd/davidson-ci: Davidson CI / quality (push) Failing after 3m55s
pauljd/davidson-ci: Davidson CI / ai-review (push) Failing after 2m54s

- Release signing: tools/sign-household.sh signs only the newest build folder
  (or an older one if its name is typed back), shows name, version, commit and
  changes, and asks first; tools/make-build-folder.sh writes BUILD.txt. Old
  per-build scripts retired (12 Nov: r5 was re-signed instead of r6).
- Version 1.0.0-rc1, build 43.
- Onboarding: when no ready-made channel matches the library, offer Create your
  own or Try other channels instead of an empty TV; a channel of your own is
  enough to carry on.
- Re-filed episodes found again by series name, season and number (two small
  requests, only when a booked episode has gone).
- TV guide footer says what Back does (to now, then main menu).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-13 00:21:30 +00:00
co-authored by Claude Opus 5.5
parent e0130c4531
commit b96b1ec195
9 changed files with 189 additions and 10 deletions
@@ -511,6 +511,34 @@ internal class EmbySampleSession(private val transport: EmbyTransport, private v
return ScheduledMedia(found, copy.sourceId, copy.durationMs)
}
/**
* The same for an episode (1.0 RC1): the series found again by its exact name, then that season's episode with the same
* number. Two small requests, only when a booked episode has gone; null when the series or the episode isn't there.
*/
fun refiledEpisode(item: SampleItem): ScheduledMedia? {
if (item.type != "Episode") return null
val (series, season, number) = Regex("""^(.*) / S(\d+) E(\d+) / """).find(item.title)?.destructured ?: return null
val term = java.net.URLEncoder.encode(series, "UTF-8")
val reply = transport.execute(EmbyRequest("GET", "/Items?UserId=$userId&Recursive=true&IncludeItemTypes=Series&SearchTerm=$term&StartIndex=0&Limit=10&EnableImages=false&EnableUserData=false", token = currentToken()))
EmbyClient.expectSuccess(reply.status, false)
val rows = EmbyClient.parse(reply.body).optJSONArray("Items") ?: return null
val named = (0 until minOf(rows.length(), 10)).mapNotNull { rows.optJSONObject(it) }
.filter { seriesKey(it.optString("Name")) == seriesKey(series) && EmbyClient.validId(it.optString("Id")) }.take(2)
for (show in named) {
val episodes = transport.execute(EmbyRequest("GET", "/Shows/${show.optString("Id")}/Episodes?UserId=$userId&Season=$season&Fields=MediaSources&EnableImages=false&EnableUserData=false", token = currentToken()))
EmbyClient.expectSuccess(episodes.status, false)
val list = EmbyClient.parse(episodes.body).optJSONArray("Items") ?: continue
val episode = (0 until minOf(list.length(), 200)).mapNotNull { list.optJSONObject(it) }
.firstOrNull { it.optInt("ParentIndexNumber", -1) == season.toInt() && it.optInt("IndexNumber", -1) == number.toInt() }
?.let { poolEpisode(it, BoxDecoders::canDecode, englishAudio = false) } ?: continue
if (episode.id == item.id) return null
val found = scheduledItem(series, episode)
rememberScheduledItems(listOf(found))
return ScheduledMedia(found, episode.sourceId, episode.durationMs)
}
return null
}
fun checkMetadataCoverage(checkActive: () -> Unit = {}): List<MetadataCoverage> =
auditMetadataCoverage(transport, userId, ::currentToken, checkActive)
fun importCatalogue(sink: CatalogueSink, maxPages: Int = CATALOGUE_PAGES_PER_RUN, pause: () -> Unit = {}, checkActive: () -> Unit = {}, onPage: () -> Unit = {},
@@ -75,7 +75,7 @@ internal fun readWholeSeries(transport: EmbyTransport, userId: String, token: ()
return PoolSeries(series.id, series.title, episodes.sortedBy { it.mark }.distinctBy { it.mark })
}
private fun poolEpisode(item: org.json.JSONObject, canDecode: (String) -> Boolean, englishAudio: Boolean): PoolEpisode? {
internal fun poolEpisode(item: org.json.JSONObject, canDecode: (String) -> Boolean, englishAudio: Boolean): PoolEpisode? {
val id = item.optString("Id")
val season = item.optInt("ParentIndexNumber", -1)
val number = item.optInt("IndexNumber", -1)
@@ -297,7 +297,8 @@ internal fun GuideGrid(channels: List<SampleChannel>, selectedNumber: Int, modif
}
}
Row(Modifier.fillMaxWidth()) {
Text("▲▼ Channel ◄► Time (◄ back two days for Catch Up) Hold ◄► Day OK Watch", Modifier.weight(1f), color = Muted, fontSize = 11.sp)
// What Back does here, always in words (1.0 RC1): back to now first, then out of the guide.
Text("▲▼ Channel ◄► Time (◄ back two days for Catch Up) Hold ◄► Day OK Watch Back " + if (awayFromNow) "To now" else "Main menu", Modifier.weight(1f), color = Muted, fontSize = 11.sp)
if (rowsShown < channels.size) Text("Channels ${firstRow + 1} to ${firstRow + rowsShown} of ${channels.size}", color = Muted, fontSize = 11.sp)
}
}
@@ -282,6 +282,8 @@ private fun ChannelsStep(onNext: () -> Unit) {
Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(16.dp)) {
OrbitButton("Set up ${ticked.size} channels", enabled = ticked.isNotEmpty(), onClick = { ChannelSetup.begin(SmartChannels.map { it.number }.filter { it in ticked }) })
if (maker != null) OrbitButton("Create your own", onClick = { made = null; creating = true })
// A channel of your own is enough to go on with (1.0 RC1): first run never needs a ready-made one to match.
if (made != null) OrbitButton("Next", onClick = onNext)
Text("Change them any time in Settings › Channels.", color = Muted, fontSize = 13.sp)
}
}
@@ -303,11 +305,18 @@ private fun ChannelsStep(onNext: () -> Unit) {
drawLine(Color(0xFF14213D), eye - Offset(r * .2f, 0f), eye + Offset(r * .2f, 0f), r * .07f)
}
}
Text(if (ChannelSetup.finished) "All matched" else "Drift's matching your library", color = Ink, fontSize = 20.sp, fontWeight = FontWeight.SemiBold, textAlign = TextAlign.Center)
// None of them matched (1.0 RC1: a library unlike the ones Orbit's channels were made for). First run must still
// end on a programme, so instead of carrying on to an empty TV, it offers a channel made from what the library has.
val noneMatched = ChannelSetup.finished && ChannelSetup.found.values.none { it > 0 }
Text(if (noneMatched) "Nothing matched yet" else if (ChannelSetup.finished) "All matched" else "Drift's matching your library", color = Ink, fontSize = 20.sp, fontWeight = FontWeight.SemiBold, textAlign = TextAlign.Center)
val now = System.currentTimeMillis()
Text(if (ChannelSetup.finished) "${ChannelSetup.found.values.filter { it > 0 }.sum()} titles across ${ChannelSetup.found.count { it.value > 0 }} channels"
Text(if (noneMatched) "None of these found their shows in your library. Make a channel from what you have, or try others."
else if (ChannelSetup.finished) "${ChannelSetup.found.values.filter { it > 0 }.sum()} titles across ${ChannelSetup.found.count { it.value > 0 }} channels"
else "${ChannelSetup.found.size} of ${ChannelSetup.wanted.size} channels · about ${ChannelSetup.minutesLeft(now + t * 0)} min left", color = Yellow, fontSize = 14.sp, textAlign = TextAlign.Center)
if (ChannelSetup.finished) OrbitButton("Next", Modifier.padding(top = 16.dp).width(180.dp).focusRequester(go), centred = true, onClick = onNext)
if (noneMatched) {
if (maker != null) OrbitButton("Create your own", Modifier.padding(top = 16.dp).width(220.dp).focusRequester(go), centred = true, onClick = { made = null; ChannelSetup.begin(emptyList()); creating = true })
OrbitButton("Try other channels", Modifier.padding(top = 8.dp).width(220.dp).then(if (maker == null) Modifier.focusRequester(go) else Modifier), centred = true, onClick = { ChannelSetup.begin(emptyList()) })
} else if (ChannelSetup.finished) OrbitButton("Next", Modifier.padding(top = 16.dp).width(180.dp).focusRequester(go), centred = true, onClick = onNext)
}
Column(Modifier.weight(1f).fillMaxHeight(), verticalArrangement = Arrangement.spacedBy(5.dp)) {
Text("Here's where everything goes", color = Ink, fontFamily = Anton, fontSize = 26.sp)
@@ -97,15 +97,15 @@ internal fun retimedPlan(plan: ChannelPlan, startMs: Long, actualMs: Long): Chan
}
/**
* Opens a booked programme. A film the server answers for with an error because its number has gone (404, or Emby's 500
* for an item it no longer has) is looked for once by title; the copy found plays in the same slot, and on a live channel
* Opens a booked programme. A film or episode the server answers for with an error because its number has gone (404, or
* Emby's 500 for an item it no longer has) is looked for once by title (an episode by its series and number); the copy found plays in the same slot, and on a live channel
* the schedule is updated to it, so the guide and every screen agree. Returns the plan and the programme as now booked.
*/
internal fun openBooked(session: EmbySampleSession, channel: SampleChannel, store: ScheduleStore, show: SampleBroadcast, live: Boolean, ahead: Boolean = false): Pair<EmbyPlaybackPlan, SampleBroadcast> {
try { return session.prepareForTuning(show.media.item, show.media.sourceId, ahead) { Thread.sleep(2_000) } to show }
catch (failure: EmbyCheckException) {
if (failure.httpStatus != 404 && failure.httpStatus != 500) throw failure
val found = session.refiledFilm(show.media.item) ?: throw failure
val found = session.refiledFilm(show.media.item) ?: session.refiledEpisode(show.media.item) ?: throw failure
android.util.Log.i("OrbitSchedule", "channel=${channel.number} refiled old=${show.media.item.id} new=${found.item.id}")
if (live) PlanEdits.replace(channel, store, session.accountId, show.startMs, show.media.item.id, found)
// Booked in the old slot; the length check that follows then re-times it for the copy's own length.