Approved Drive-In events book on their IMDb IDs, not their cast lists

A person an event is built around (Arnie) was a rule for choosing its films. Once approved, the films are pinned by IMDb
ID, so booking checks only the right film and a copy that plays; an incomplete cast list in a library no longer drops the
event. Discovery can still use the person rule ([checkEventFilm] keeps it). No change on Paul's server: its Arnie films
already list him, and the saved event signature is unchanged.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-11-06 02:59:47 +00:00
co-authored by Claude Opus 5.5
parent 1d2c524b04
commit 56e017ec90
4 changed files with 22 additions and 14 deletions
@@ -218,13 +218,15 @@ internal class ChannelScheduler(private val store: ScheduleStore,
*/
private fun eventFilms(userId: String, session: EmbySampleSession?, events: List<DriveInEvent>, now: Long): List<PoolSeries> {
if (events.isEmpty()) return emptyList()
// Every copy of a curated film is read, so a duplicate this box can't play doesn't sink the event.
// Every copy of a curated film is read, so a duplicate this box can't play doesn't sink the event. An approved event's
// films are pinned by IMDb ID, so playing one needs only the right film and a copy that plays: a person the event is
// about (Arnie) was a rule for choosing its films, not for showing them, and a library's cast list can be incomplete.
fun copiesOf(event: DriveInEvent, film: EventFilm) = eventFilmCopies(event, film, CuratedDriveInEvents.copies)
val signature = eventSignature(events, CuratedDriveInEvents.copies)
val saved = store.loadPool(userId, DRIVE_IN_NUMBER)?.takeIf { it.signature == signature }
if (session == null || (saved != null && now - saved.fetchedAtMs < 24 * 60 * 60_000L)) return saved?.series.orEmpty()
return try {
val checks = session.readFilmChecks(events.flatMap { event -> event.films.flatMap { f -> copiesOf(event, f).map { EventFilm(f.title, f.year, f.imdb, it) to event.person } } })
val checks = session.readFilmChecks(events.flatMap { event -> event.films.flatMap { f -> copiesOf(event, f).map { EventFilm(f.title, f.year, f.imdb, it) to null } } })
Log.i("OrbitSchedule", "channel=$DRIVE_IN_NUMBER eventFilms=${checks.size} " + checks.values.groupingBy { it.reason }.eachCount().entries.joinToString(" ") { "${it.key.replace(' ', '_')}=${it.value}" })
checks.values.mapNotNull { it.film }.also { store.savePool(userId, DRIVE_IN_NUMBER, ScheduleStore.SavedPool(it, now, signature)) }
} catch (failure: EmbyCheckException) {
@@ -6,8 +6,8 @@ import java.time.LocalDate
/**
* Curated Drive-In events (Living Network Stage F; the ten concepts and dates approved by Paul on 4 November 2026, from
* docs/drive-in-curation-suggestions-2026-11-04.md). Each is a fixed bill on its evening, booked only when every film is
* verified: the exact library item, its IMDb ID, a copy this box can play, its runtime, rested, not on another channel
* then and, where an event names a person (Arnie), that person in the film's own cast from Emby's People data. An event
* verified: the film by its IMDb ID, a copy this box can play, its runtime, rested and not on another channel then. (Where
* an event names a person, as Arnie does, that chose its films; it isn't checked again when booking.) An event
* that fails any of these isn't booked at all and the evening is booked as usual; nothing already booked is ever changed.
*/
internal class EventFilm(val title: String, val year: Int, val imdb: String,
@@ -17,7 +17,10 @@ internal class EventFilm(val title: String, val year: Int, val imdb: String,
internal class DriveInEvent(val key: String, val name: String, val evening: LocalDate, val hour: Int, val minute: Int, val films: List<EventFilm>,
/** An approved takeover identity, or "" for the Drive-In's own. */
val presentation: String = "",
/** Someone every film must have in its cast, checked against Emby's People data. */
/**
* The person the event is built around, a rule for choosing its films (discovery), not for showing them: once approved,
* the films are pinned by IMDb ID and book on that alone (Paul, 6 November 2026).
*/
val person: String? = null) {
/** A late double after the evening's main film, rather than the main bill itself. */
val late get() = hour >= 22
@@ -232,12 +232,9 @@ internal class EmbySampleSession(private val transport: EmbyTransport, private v
}
/**
* The curated Drive-In events' films, read by their exact library items in one request, with their media, IMDb IDs and
* Exact films, each with the person its cast must include (or null), read in one request with their media, IMDb IDs and
* cast, each checked by [checkEventFilm]. Read only: nothing is changed in the library.
*/
fun readEventFilms(events: List<DriveInEvent>): Map<String, EventFilmCheck> = readFilmChecks(events.flatMap { event -> event.films.map { it to event.person } })
/** Exact films, each with the person its cast must include (or null), read and checked as [readEventFilms] does. */
fun readFilmChecks(listed: List<Pair<EventFilm, String?>>): Map<String, EventFilmCheck> {
val films = listed.distinctBy { it.first.itemId }
val ids = films.map { it.first.itemId }.filter(EmbyClient::validId)