0.99.10: catalogue hybrid on ToonZ and Tots (full) and Odyssey and Three (keeping at least half the tier); every pool read again once
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -51,13 +51,15 @@ internal data class ChannelProgramming(val number: Int, val name: String, val se
|
||||
* so a short catalogue comes round at a pace it can sustain instead of every week. Null keeps every tier whole.
|
||||
*/
|
||||
val catalogueScaleHours: Double? = null,
|
||||
/** With [catalogueScaleHours]: the least share of its tier's weight a short catalogue keeps. */
|
||||
val catalogueScaleFloor: Double = MIN_CATALOGUE_SCALE,
|
||||
/** Library items taken off this channel by editorial decision, by their Emby id, whichever way they reached its pool. */
|
||||
val withdrawn: Set<String> = emptySet()) {
|
||||
/** A show's weight here, by its tier (a show the brief doesn't name counts as supporting), scaled by [catalogueScaleHours]. */
|
||||
fun weightOf(show: PoolSeries): Double {
|
||||
val tier = tierWeights?.get(seriesKey(show.title)) ?: TIER_SUPPORTING
|
||||
val hours = show.episodes.sumOf { it.durationMs } / 3_600_000.0
|
||||
return tier * (catalogueScaleHours?.let { (hours / it).coerceIn(MIN_CATALOGUE_SCALE, 1.0) } ?: 1.0)
|
||||
return tier * (catalogueScaleHours?.let { (hours / it).coerceIn(catalogueScaleFloor, 1.0) } ?: 1.0)
|
||||
}
|
||||
/** Whether a show plays its episodes in a mixed order here. */
|
||||
fun mixes(show: PoolSeries) = shuffleEpisodes || seriesKey(show.title) in shuffleTitles.mapTo(HashSet(), ::seriesKey)
|
||||
@@ -170,14 +172,21 @@ internal val SmartChannels = listOf(
|
||||
// Reads every show on its list, as the other curated channels do. Its old limit of 20 dates from when the list was short.
|
||||
ChannelProgramming(201, "Terra", TerraShows, seriesCount = TerraShows.size, finishTogether = true, exactTitles = true, dayParts = TerraDayParts),
|
||||
ChannelProgramming(TOTS_NUMBER, "Tots", TotsShows, seriesCount = 40, finishTogether = true, exactTitles = true, dayParts = TotsDayParts, shuffleEpisodes = true,
|
||||
tierWeights = TotsTiers),
|
||||
tierWeights = TotsTiers, catalogueScaleHours = CATALOGUE_SCALE_HOURS),
|
||||
ChannelProgramming(106, "Paradox", ParadoxShows, seriesCount = 20, finishTogether = true, exactTitles = true, dayParts = ParadoxDayParts, shuffleTitles = ParadoxStandalones.toSet(),
|
||||
tierWeights = ParadoxTiers)) +
|
||||
ChannelPresets.filter { it.smartOnly }.map { ChannelProgramming(it.number, it.name, it.searches, seriesCount = if (it.films) it.searches.size else 60, finishTogether = !it.films, exactTitles = true,
|
||||
filmRestMs = if (it.films) 7 * 24 * 60 * 60_000L else null,
|
||||
suggestionRules = SmartChannelRules[it.number].orEmpty(), dayParts = SmartChannelParts[it.number].orEmpty(), shuffleTitles = SmartChannelMixed[it.number].orEmpty(),
|
||||
channelFilms = if (it.number == 401) PpvSunday else emptyList(), tierWeights = SmartChannelTiers[it.number], adaptiveFilmRest = it.number in AdaptiveFilmRestChannels,
|
||||
catalogueScaleHours = if (it.number in CatalogueScaledChannels) CATALOGUE_SCALE_HOURS else null) }
|
||||
catalogueScaleHours = if (it.number in CatalogueScaledChannels) CATALOGUE_SCALE_HOURS else null,
|
||||
catalogueScaleFloor = CatalogueScaleFloors[it.number] ?: MIN_CATALOGUE_SCALE) }
|
||||
|
||||
/**
|
||||
* Where a short series must keep at least half its tier's weight, so the hybrid trims its weekly repeats without cutting its
|
||||
* airings by half: Orbit Three's Spaced and Phoenix Nights, and Odyssey's Wonders series (4 November 2026).
|
||||
*/
|
||||
private val CatalogueScaleFloors get() = mapOf(103 to 0.5, 202 to 0.5)
|
||||
|
||||
/** Film channels whose rest adapts to their pools: Premiere, whose pool runs well past a week (After Dark is set above). Proposed 4 November 2026. */
|
||||
private val AdaptiveFilmRestChannels get() = setOf(301)
|
||||
@@ -186,8 +195,11 @@ private val AdaptiveFilmRestChannels get() = setOf(301)
|
||||
private val SmartChannelTiers: Map<Int, Map<String, Double>> get() = mapOf(103 to ThreeTiers, 202 to OdysseyTiers, 203 to WildTiers, 603 to OrbitXTiers, 605 to ToonZTiers,
|
||||
101 to Orbit1Tiers, 102 to Orbit2Tiers, 104 to GoldTiers, 107 to EvidenceTiers, 602 to HeroesTiers, 604 to RewindTiers, 204 to DarkFilesTiers)
|
||||
|
||||
/** Weighted channels whose short catalogues are scaled down ([ChannelProgramming.catalogueScaleHours]): Rewind and Dark Files (Vortex is set above). */
|
||||
private val CatalogueScaledChannels get() = setOf(604, 204)
|
||||
/**
|
||||
* Weighted channels whose short catalogues are scaled down ([ChannelProgramming.catalogueScaleHours]): Rewind and Dark Files,
|
||||
* then Orbit Three, Odyssey and ToonZ (approved 4 November 2026; Vortex and Tots are set above).
|
||||
*/
|
||||
private val CatalogueScaledChannels get() = setOf(604, 204, 103, 202, 605)
|
||||
|
||||
/** Shows that play in a mixed order on channels whose identity is agreed. See ChannelIdentities.kt. */
|
||||
private val SmartChannelMixed: Map<Int, Set<String>> get() = mapOf(101 to Orbit1Mixed, 102 to Orbit2Mixed, 103 to ThreeMixed, 104 to GoldMixed, 105 to RiotMixed,
|
||||
@@ -252,7 +264,8 @@ internal data class ChannelPlan(val entries: List<ScheduleEntry>, val tail: Sche
|
||||
}
|
||||
|
||||
/** Bump when the way pools are read changes, so each channel reads its once again. */
|
||||
private const val CHANNEL_POOL_VERSION = 4
|
||||
// 5 (4 November 2026): every pool read again before the coordinated cutover, with the pool diagnostics from 0.99.7.
|
||||
private const val CHANNEL_POOL_VERSION = 5
|
||||
|
||||
internal const val SCHEDULE_AHEAD_MS = 7 * 24 * 60 * 60_000L
|
||||
internal const val SCHEDULE_TOP_UP_MS = 6 * 24 * 60 * 60_000L
|
||||
|
||||
@@ -66,7 +66,7 @@ internal class HttpsEmbyTransport(internal val deviceId: String = UUID.randomUUI
|
||||
connection.connectTimeout = 10_000
|
||||
connection.readTimeout = request.readTimeoutMs ?: if (request.path == "/Sessions/Logout") 5_000 else 15_000
|
||||
connection.setRequestProperty("Accept", "application/json")
|
||||
connection.setRequestProperty("X-Emby-Authorization", "Emby Client=\"Orbit TV\", Device=\"Orbit TV\", DeviceId=\"$deviceId\", Version=\"0.99.9\"")
|
||||
connection.setRequestProperty("X-Emby-Authorization", "Emby Client=\"Orbit TV\", Device=\"Orbit TV\", DeviceId=\"$deviceId\", Version=\"0.99.10\"")
|
||||
request.token?.let { connection.setRequestProperty("X-Emby-Token", it) }
|
||||
if (request.method == "POST") {
|
||||
val bytes = request.body.orEmpty().toByteArray(Charsets.UTF_8)
|
||||
|
||||
@@ -33,7 +33,7 @@ internal class SecureMediaDataSource(private val session: EmbySampleSession) : B
|
||||
next.instanceFollowRedirects = false
|
||||
next.connectTimeout = 10_000
|
||||
next.readTimeout = 20_000
|
||||
next.setRequestProperty("User-Agent", "OrbitTV/0.99.9")
|
||||
next.setRequestProperty("User-Agent", "OrbitTV/0.99.10")
|
||||
next.setRequestProperty("Accept-Encoding", "identity")
|
||||
session.mediaHeaders(address).forEach { (key, value) -> next.setRequestProperty(key, value) }
|
||||
if (dataSpec.position != 0L || dataSpec.length != C.LENGTH_UNSET.toLong()) {
|
||||
|
||||
Reference in New Issue
Block a user