Approvals without a block air on channels made only of named blocks; event names with years match (build 72)
On a channel whose every hour belongs to a named block, a title approved without a block never aired (Terra's Blue Planet III and Africa). It now joins each everyday block, except one kept on equal turns (Tots' Wind Down). Channels with an open block are unchanged. An event named "AEW All Out (2019)" also finds the library's "AEW All Out 2019". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -308,6 +308,24 @@ internal data class PoolEpisode(val id: String, val sourceId: String, val mark:
|
||||
* In a block's group. A film can belong to more than one, written "late+day": a film the Director's Chair moved into daytime
|
||||
* with your approval keeps its place at night too (Paul, 18 November 2026).
|
||||
*/
|
||||
/**
|
||||
* A title you approved without naming a block (the Director's Chair, the Stage 3 replacements). On a channel whose every hour
|
||||
* belongs to a named block, it joins each everyday block, except one kept on equal turns (Tots' Wind Down), so it actually airs
|
||||
* (23 November 2026: Terra's Blue Planet III and Africa, approved weeks before, had never been on). Where a channel has an open
|
||||
* everyday block it plays there, as before.
|
||||
*/
|
||||
internal const val OPEN_GROUP = "*"
|
||||
internal fun openJoins(part: DayPart, parts: List<DayPart>) = part.days.isEmpty() && part.weighted &&
|
||||
parts.none { p -> p.days.isEmpty() && p.titles.isEmpty() && p.group.isEmpty() }
|
||||
|
||||
/** [pool] with the titles approved without a block marked [OPEN_GROUP], by item or by name (an approval waiting to be found again). */
|
||||
internal fun withOpenApprovals(pool: List<PoolSeries>, choices: ChannelChoices): List<PoolSeries> {
|
||||
val open = choices.accepted.filter { it.group.isEmpty() }
|
||||
if (open.isEmpty()) return pool
|
||||
val ids = open.map { it.id }.toSet(); val keys = open.map { seriesKey(it.title) }.toSet()
|
||||
return pool.map { if (it.group.isEmpty() && (it.id in ids || seriesKey(it.title) in keys)) it.copy(group = OPEN_GROUP) else it }
|
||||
}
|
||||
|
||||
internal fun inGroup(series: PoolSeries, group: String) = group.isNotEmpty() && (series.group == group || group in series.group.split('+'))
|
||||
|
||||
internal data class PoolSeries(val id: String, val title: String, val episodes: List<PoolEpisode>, val group: String = "", val ref: String = "", val year: Int? = null) {
|
||||
@@ -397,9 +415,11 @@ internal fun dayPartFor(pool: List<PoolSeries>, parts: List<DayPart>, startMs: L
|
||||
if (part.titles.isEmpty() && part.group.isEmpty()) return Triple(pool, name, part)
|
||||
val allowed = PartPools.of(pool, part) {
|
||||
val titles = part.titles.map(::seriesKey).toSet()
|
||||
// A film is named with its year, as "Halloween (1978)"; the pool already holds that exact film under its plain title.
|
||||
val films = part.titles.map { seriesKey(FilmIdentity.of(it).title) }.toSet()
|
||||
pool.filter { seriesKey(it.title) in titles || (it.isFilm && seriesKey(it.title) in films) || inGroup(it, part.group) }
|
||||
// A film is named with its year, as "Halloween (1978)"; the pool already holds that exact film under its plain title,
|
||||
// or with the year in its name, as the VPS names its events ("AEW All Out 2019" for "AEW All Out (2019)").
|
||||
val films = part.titles.flatMap { FilmIdentity.of(it).let { f -> listOfNotNull(seriesKey(f.title), f.year?.let { y -> seriesKey("${f.title} $y") }) } }.toSet()
|
||||
val open = openJoins(part, parts)
|
||||
pool.filter { seriesKey(it.title) in titles || (it.isFilm && seriesKey(it.title) in films) || inGroup(it, part.group) || (open && it.group == OPEN_GROUP) }
|
||||
}
|
||||
if (allowed.isNotEmpty()) return Triple(allowed, name, part)
|
||||
}
|
||||
|
||||
@@ -422,7 +422,7 @@ internal class ChannelScheduler(private val store: ScheduleStore,
|
||||
// Under the plan lock, so a programme being re-timed for its real length (PlanEdits) is never written over.
|
||||
val (existing, plan) = synchronized(PlanEdits.lock) {
|
||||
val existing = store.loadPlan(userId, number)
|
||||
val plan = topUpPlan(existing, base, pool?.series?.let { withoutFailed(it, store.loadFailed(userId)) }?.let { if (programming.mixedTurns) mixedTurnOrder(it, number) else it }, now, programming.filmRestMs, programming.finishTogether, programming.dayParts,
|
||||
val plan = topUpPlan(existing, base, pool?.series?.let { withOpenApprovals(withoutFailed(it, store.loadFailed(userId)), choices) }?.let { if (programming.mixedTurns) mixedTurnOrder(it, number) else it }, now, programming.filmRestMs, programming.finishTogether, programming.dayParts,
|
||||
avoid = { show, startMs, endMs -> others(show, startMs, endMs) }, shuffle = programming.shuffleEpisodes, mixed = programming::mixes,
|
||||
weightOf = programming.tierWeights?.let { programming::weightOf }, adaptiveRest = programming.adaptiveFilmRest, fileRestMs = programming.fileRestMs, stories = programming.storyGrouping, shorts = programming.shorts, marathon = programming.marathon,
|
||||
seasonEndMs = seasonEndMs(number, now), network = network) ?: throw EmbyCheckException("${programming.name} has no episodes to schedule.")
|
||||
|
||||
Reference in New Issue
Block a user