Orbit brand packs for your channels: Orbit Mistletoe and Orbit Sakura
A channel named Mistletoe or Sakura (or given the Look on Review) wears the pack: logo, guide card, bug, background and its Blender ident. Packs are Orbit's own; a channel's file can only name one that exists. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -9,8 +9,8 @@ android {
|
||||
applicationId = "tv.orbit.classic"
|
||||
minSdk = 26
|
||||
targetSdk = 36
|
||||
versionCode = 246
|
||||
versionName = "0.108.86-create-v3"
|
||||
versionCode = 247
|
||||
versionName = "0.108.87-mistletoe-sakura"
|
||||
}
|
||||
buildFeatures { compose = true }
|
||||
// The finished build for the TVs (Paul, 6 November 2026: the test build stuttered on the box). Not debuggable, so
|
||||
|
||||
@@ -395,6 +395,7 @@ function reviewView() {
|
||||
<b style="color:var(--accent);font-size:20px">${d.number || state.channels?.next || ''}</b></div>
|
||||
${!d.name && c.suggestedName ? `<div class="small" style="margin-top:6px">The Director suggests <a href="#" data-kusename="1" style="color:var(--accent);font-weight:700">${esc(c.suggestedName)}</a></div>` : ''}
|
||||
<div class="chips" style="margin-top:10px;flex-wrap:wrap">${pillBtn(esc(style), 'data-kstyles="1"')}${pillBtn(esc(hours), 'data-kgo="when"')}${pillBtn(d.season ? seasonLabel(d.season) : 'All year', 'data-kgo="when"')}</div>
|
||||
${(state.brands || []).length ? `<div class="small" style="margin-top:10px">Look: ${[{key: '', name: 'Plain'}].concat(state.brands).map(b => `<button data-kbrand="${esc(b.key)}" style="margin:4px 4px 0 0;padding:4px 10px;border-radius:12px;font-size:12px;font-weight:700;${brandOf(d) === b.key ? 'background:var(--accent);color:var(--on-accent)' : 'background:var(--surface)'}">${esc(b.name)}</button>`).join('')}</div>` : ''}
|
||||
${c.styleOpen ? `<div style="margin-top:10px">${STYLES.map(([k, t, l]) => `<button class="ch ${d.style === k ? 'on' : ''}" data-kstyle="${k}"><div class="grow"><div class="what">${t}</div><div class="then" style="white-space:normal">${l}</div></div></button>`).join('')}</div>` : ''}</div>`;
|
||||
// The week, in plain words.
|
||||
const total = sh?.hours;
|
||||
@@ -415,6 +416,8 @@ function reviewView() {
|
||||
<button class="btn" data-kmake="save" style="margin-top:8px">${d.number ? 'Save changes' : 'Create channel'}</button></div></div>`;
|
||||
}
|
||||
|
||||
// Orbit brand packs: chosen here, or matched by name ("Sakura" wears Orbit Sakura) until you choose.
|
||||
const brandOf = d => d.brand !== undefined ? d.brand : ((state.brands || []).find(b => [b.name, b.name.replace(/^Orbit /, '')].some(n => n.toLowerCase() === (d.name || '').trim().toLowerCase()))?.key || '');
|
||||
function doneView() {
|
||||
const c = state.create, k = c.done;
|
||||
return `<div style="text-align:center;padding:40px 8px 0"><div style="font-size:44px;color:var(--mint)">✓</div>
|
||||
@@ -474,7 +477,9 @@ function startCreate(draft) {
|
||||
}
|
||||
// Name the Director suggests: the collection's own name, or the description in a few words.
|
||||
const suggestName = text => text.replace(/\s+/g, ' ').trim().split(' ').slice(0, 3).map(w => w.charAt(0).toUpperCase() + w.slice(1)).join(' ').slice(0, 40);
|
||||
function goTo(view) { const c = state.create; c.view = view; c.note = ''; render(); scrollTo(0, 0);
|
||||
function goTo(view) { const c = state.create; c.view = view; c.note = '';
|
||||
if (view === 'review' && !state.brands) api('/api/brands').then(r => { state.brands = r.packs; if (state.create?.view === 'review') render(); }).catch(() => { state.brands = []; });
|
||||
render(); scrollTo(0, 0);
|
||||
if (view === 'shape' || (view === 'review' && !c.shape) || view === 'when') shapeShows(); if (view === 'review') checkClashes(); }
|
||||
async function runSearch() {
|
||||
const c = state.create; c.query = ($('#kq')?.value || '').trim(); if (c.query.length < 2 || c.busy) return;
|
||||
@@ -566,7 +571,8 @@ async function makeChannel(ending) {
|
||||
d.name = ($('#kname')?.value || d.name || '').trim(); if (!d.name) { toast('Give it a name first'); return; }
|
||||
c.busy = true; render();
|
||||
try { const r = await api('/api/channels', {number: d.number, name: d.name, description: d.description, style: d.style, hours: d.hours, shows: d.shows,
|
||||
slots: d.style === 'Shaped' ? d.slots : undefined, core: d.style === 'Shaped' ? d.core : undefined, season: d.season || null});
|
||||
slots: d.style === 'Shaped' ? d.slots : undefined, core: d.style === 'Shaped' ? d.core : undefined, season: d.season || null,
|
||||
brand: d.brand !== undefined ? d.brand : undefined});
|
||||
c.done = {number: r.number, name: d.name, message: r.message, edit: !!d.number}; c.busy = false; render(); load('more');
|
||||
// Create & watch next: queued for after the programme on now, never interrupting it (Paul, 7 November 2026).
|
||||
if (ending === 'next') { await watchNew('next'); }
|
||||
@@ -705,6 +711,7 @@ document.addEventListener('click', e => {
|
||||
if (d.kseechosen) { chosenSheet(); return; }
|
||||
if (d.kunpick) { const dr = state.create.draft; dr.shows = dr.shows.filter(x => x.id !== d.kunpick); chosenSheet(); render(); return; }
|
||||
if (d.kmake) { makeChannel(d.kmake); return; }
|
||||
if (d.kbrand !== undefined) { const c = state.create; c.draft.name = ($('#kname')?.value || c.draft.name || '').trim(); c.draft.brand = d.kbrand; render(); return; }
|
||||
if (d.create) { startCreate({name: '', description: '', style: 'Shaped', hours: null, shows: [], skipped: []}); return; }
|
||||
if (d.edit) { const ch = state.channels?.channels.find(x => x.number === +d.edit); if (!ch) return;
|
||||
api('/api/shows?number=' + ch.number).then(shows => {
|
||||
|
||||
@@ -41,11 +41,11 @@ internal object ChannelBrands {
|
||||
107 to ChannelBranding("evidence", "Orbit Evidence", R.drawable.evidence_epg, R.drawable.evidence_background, R.drawable.evidence_bug, ChannelCategory.Entertainment),
|
||||
201 to ChannelBranding("orbit-terra", "Orbit Terra", R.drawable.orbit_terra_epg, R.drawable.orbit_terra_background, R.drawable.orbit_terra_bug, ChannelCategory.Documentaries),
|
||||
106 to ChannelBranding("paradox", "Orbit Paradox", R.drawable.paradox_epg, R.drawable.paradox_background, R.drawable.paradox_bug, ChannelCategory.Entertainment))
|
||||
fun forNumber(number: Int): ChannelBranding? = brands[number]
|
||||
fun forNumber(number: Int): ChannelBranding? = brands[number] ?: CustomChannels.of(number)?.brand?.let { BrandPacks[it] }
|
||||
/** Every channel's guide logo, to decode ahead. */
|
||||
fun allLogos(): List<Int> = brands.values.map { it.logo }.distinct()
|
||||
/** Saved channels keep their original names; what the viewer sees comes from the brand. */
|
||||
fun displayName(channel: SampleChannel) = brands[channel.number]?.displayName ?: channel.name
|
||||
fun displayName(channel: SampleChannel) = forNumber(channel.number)?.displayName ?: channel.name
|
||||
}
|
||||
|
||||
internal fun availableSampleChannels(vararg channels: SampleChannel?): List<SampleChannel> =
|
||||
@@ -56,3 +56,16 @@ internal fun channelAfter(numbers: List<Int>, current: Int, step: Int): Int {
|
||||
val index = numbers.indexOf(current)
|
||||
return if (index < 0 || numbers.isEmpty()) current else numbers[Math.floorMod(index + step, numbers.size)]
|
||||
}
|
||||
|
||||
/**
|
||||
* Orbit-made brand packs a channel of your own can wear (Paul, 7 November 2026: Orbit Mistletoe and Orbit Sakura): logo,
|
||||
* guide bug, background and ident, so a channel made with Smart setup looks like one of Orbit's own.
|
||||
*/
|
||||
internal val BrandPacks: Map<String, ChannelBranding> = mapOf(
|
||||
"orbit-mistletoe" to ChannelBranding("orbit-mistletoe", "Orbit Mistletoe", R.drawable.orbit_mistletoe_epg, R.drawable.orbit_mistletoe_background, R.drawable.orbit_mistletoe_bug, ChannelCategory.Movies),
|
||||
"orbit-sakura" to ChannelBranding("orbit-sakura", "Orbit Sakura", R.drawable.orbit_sakura_epg, R.drawable.orbit_sakura_background, R.drawable.orbit_sakura_bug, ChannelCategory.Cartoons))
|
||||
internal val BrandPackIdents: Map<String, Int> = mapOf("orbit-mistletoe" to R.raw.ident_mistletoe, "orbit-sakura" to R.raw.ident_sakura)
|
||||
|
||||
/** The pack whose name a channel's name matches ("Mistletoe" or "Orbit Mistletoe"), or null. */
|
||||
internal fun brandPackFor(name: String): String? = BrandPacks.entries.firstOrNull { (_, b) ->
|
||||
name.trim().equals(b.displayName, ignoreCase = true) || name.trim().equals(b.displayName.removePrefix("Orbit "), ignoreCase = true) }?.key
|
||||
|
||||
@@ -177,7 +177,7 @@ internal fun CreateChannelFlow(maker: ChannelMaker, editing: CustomChannel?, onD
|
||||
// Editing on the TV keeps what the phone set: the season, and a shaped layout while the shows and style stay.
|
||||
val kept = editing?.takeIf { it.style == style && it.shows.toSet() == chosen.map { c -> c.title }.toSet() }
|
||||
val channel = CustomChannel(number, name.trim(), style, hours, description.trim(), chosen.map { it.title },
|
||||
slots = kept?.slots.orEmpty(), core = kept?.core.orEmpty(), season = editing?.season)
|
||||
slots = kept?.slots.orEmpty(), core = kept?.core.orEmpty(), season = editing?.season, brand = editing?.brand ?: brandPackFor(name))
|
||||
onDone(runCatching { maker.create(channel, chosen) }.getOrElse { "That channel couldn't be made. Try again." })
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,11 +42,13 @@ internal data class CustomChannel(val number: Int, val name: String, val style:
|
||||
/** Shaped only: each title's slot, and the core titles. */
|
||||
val slots: Map<String, Slot> = emptyMap(), val core: Set<String> = emptySet(),
|
||||
/** On air only through this part of the year, if you chose one (Paul, 7 November 2026: an optional choice, with dates). */
|
||||
val season: SeasonWindow? = null) {
|
||||
val season: SeasonWindow? = null,
|
||||
/** An Orbit brand pack it wears ([BrandPacks]), or null for the plain Yours look. */
|
||||
val brand: String? = null) {
|
||||
init { require(number in YOURS_FIRST..YOURS_LAST && name.isNotBlank() && name.length <= 40) }
|
||||
fun toJson(): JSONObject = JSONObject().put("number", number).put("name", name).put("style", style.name).put("description", description)
|
||||
.put("hours", hours?.let { JSONObject().put("from", it.fromHour).put("to", it.toHour) } ?: JSONObject.NULL).put("shows", JSONArray(shows))
|
||||
.put("slots", JSONObject(slots.mapValues { it.value.name })).put("core", JSONArray(core.toList())).put("season", season?.toJson() ?: JSONObject.NULL)
|
||||
.put("slots", JSONObject(slots.mapValues { it.value.name })).put("core", JSONArray(core.toList())).put("season", season?.toJson() ?: JSONObject.NULL).put("brand", brand ?: JSONObject.NULL)
|
||||
companion object {
|
||||
fun fromJson(o: JSONObject) = CustomChannel(o.getInt("number"), o.getString("name").take(40),
|
||||
runCatching { PlayStyle.valueOf(o.optString("style")) }.getOrDefault(PlayStyle.Standard),
|
||||
@@ -54,7 +56,7 @@ internal data class CustomChannel(val number: Int, val name: String, val style:
|
||||
o.optJSONArray("shows")?.let { a -> (0 until minOf(a.length(), 200)).map { a.getString(it).take(160) } }.orEmpty(),
|
||||
o.optJSONObject("slots")?.let { m -> m.keys().asSequence().take(200).mapNotNull { k -> runCatching { k.take(160) to Slot.valueOf(m.getString(k)) }.getOrNull() }.toMap() }.orEmpty(),
|
||||
o.optJSONArray("core")?.let { a -> (0 until minOf(a.length(), 20)).map { a.getString(it).take(160) }.toSet() }.orEmpty(),
|
||||
SeasonWindow.of(o.optJSONObject("season")))
|
||||
SeasonWindow.of(o.optJSONObject("season")), o.optString("brand").takeIf { it in BrandPacks })
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -62,9 +62,9 @@ internal class HttpsEmbyTransport(internal val deviceId: String = UUID.randomUUI
|
||||
}
|
||||
/** The sign-in headers for this kind of server. */
|
||||
internal fun authHeaders(token: String?): Map<String, String> = when (kind) {
|
||||
ServerKind.Emby -> mapOf("X-Emby-Authorization" to "Emby Client=\"Orbit TV\", Device=\"Orbit TV\", DeviceId=\"$deviceId\", Version=\"0.108.86\"") +
|
||||
ServerKind.Emby -> mapOf("X-Emby-Authorization" to "Emby Client=\"Orbit TV\", Device=\"Orbit TV\", DeviceId=\"$deviceId\", Version=\"0.108.87\"") +
|
||||
(token?.let { mapOf("X-Emby-Token" to it) } ?: emptyMap())
|
||||
ServerKind.Jellyfin -> mapOf("Authorization" to "MediaBrowser Client=\"Orbit TV\", Device=\"Orbit TV\", DeviceId=\"$deviceId\", Version=\"0.108.86\"" +
|
||||
ServerKind.Jellyfin -> mapOf("Authorization" to "MediaBrowser Client=\"Orbit TV\", Device=\"Orbit TV\", DeviceId=\"$deviceId\", Version=\"0.108.87\"" +
|
||||
(token?.let { ", Token=\"$it\"" } ?: ""))
|
||||
}
|
||||
/** One picture from the provider, or nothing. Same fixed origin and no redirects, and failures are never shown or logged. */
|
||||
|
||||
@@ -38,7 +38,7 @@ private val IdentVideos = mapOf(108 to R.raw.ident_108, 109 to R.raw.ident_109,
|
||||
611 to R.raw.ident_611, 612 to R.raw.ident_612, 613 to R.raw.ident_613)
|
||||
|
||||
/** [atMs] is when the next programme starts, for a channel whose ident follows the time of day. */
|
||||
internal fun identVideo(number: Int, atMs: Long = 0) = if (number == TOTS_NUMBER) totsVideo(atMs) else IdentVideos[number]
|
||||
internal fun identVideo(number: Int, atMs: Long = 0) = if (number == TOTS_NUMBER) totsVideo(atMs) else IdentVideos[number] ?: CustomChannels.of(number)?.brand?.let { BrandPackIdents[it] }
|
||||
internal fun identLength(number: Int, atMs: Long = 0) = when (number) {
|
||||
TOTS_NUMBER -> totsMood(atMs).lengthMs
|
||||
in IdentVideos -> IDENT_VIDEO_MS
|
||||
|
||||
@@ -324,6 +324,7 @@ internal object PhoneLink {
|
||||
.put("networks", JSONArray(nets.map { (n, k) -> JSONObject().put("name", n).put("count", k) })).put("genres", JSONArray(genres))
|
||||
.put("titles", JSONArray(titles.map(::suggestionJson))))
|
||||
}
|
||||
"GET /api/brands" -> json(out, 200, JSONObject().put("packs", JSONArray(BrandPacks.map { (k, b) -> JSONObject().put("key", k).put("name", b.displayName) })))
|
||||
"GET /api/collections" -> {
|
||||
val all = runBlocking { h.maker.collections() }
|
||||
json(out, 200, JSONObject().put("collections", JSONArray(all.map { c -> JSONObject().put("name", c.name).put("count", c.members.size).put("total", c.total).put("complete", c.complete) })))
|
||||
@@ -376,7 +377,9 @@ internal object PhoneLink {
|
||||
if (shows.isEmpty()) return json(out, 400, JSONObject().put("error", "Add at least one show or film."))
|
||||
// Shaped: the phone's layout, by item, kept by title as the planner reads it.
|
||||
val titleOf = shows.associate { it.id to it.title }
|
||||
val seasoned = channel.copy(season = SeasonWindow.of(o.optJSONObject("season")))
|
||||
// An Orbit brand pack: the one chosen, else the one the name matches ("Sakura" wears Orbit Sakura).
|
||||
val chosenBrand = if (o.has("brand")) o.optString("brand").takeIf { it in BrandPacks } else brandPackFor(channel.name)
|
||||
val seasoned = channel.copy(season = SeasonWindow.of(o.optJSONObject("season")), brand = chosenBrand)
|
||||
val laidOut = if (seasoned.style != PlayStyle.Shaped) seasoned else seasoned.copy(
|
||||
slots = o.optJSONObject("slots")?.let { m -> m.keys().asSequence().mapNotNull { id -> titleOf[id]?.let { t -> runCatching { t to Slot.valueOf(m.getString(id)) }.getOrNull() } }.toMap() }.orEmpty(),
|
||||
core = o.optJSONArray("core")?.let { a -> (0 until minOf(a.length(), 20)).mapNotNull { titleOf[a.getString(it)] }.toSet() }.orEmpty())
|
||||
|
||||
@@ -39,7 +39,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.108.86")
|
||||
next.setRequestProperty("User-Agent", "OrbitTV/0.108.87")
|
||||
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()) {
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 35 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.9 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 6.1 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 21 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 2.2 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 5.3 KiB |
Binary file not shown.
Binary file not shown.
@@ -85,4 +85,13 @@ class SmartSetupTest {
|
||||
val before = YourBriefs
|
||||
try { YourBriefs = listOf(brief); assertTrue(Briefs.any { it.number == 701 }); assertTrue(Briefs.any { it.number == 101 }) } finally { YourBriefs = before }
|
||||
}
|
||||
|
||||
@Test fun yourChannelsCanWearAnOrbitBrandPack() {
|
||||
assertEquals("orbit-sakura", brandPackFor("Sakura")); assertEquals("orbit-mistletoe", brandPackFor("orbit mistletoe")); assertNull(brandPackFor("The Unknown"))
|
||||
val c = CustomChannel(702, "Sakura", PlayStyle.Shaped, brand = "orbit-sakura")
|
||||
assertEquals("orbit-sakura", CustomChannel.fromJson(JSONObject(c.toJson().toString())).brand)
|
||||
assertNull(CustomChannel.fromJson(JSONObject(c.copy(brand = null).toJson().toString())).brand)
|
||||
assertNull(CustomChannel.fromJson(JSONObject(c.toJson().put("brand", "not-a-pack").toString())).brand) // only Orbit's own packs
|
||||
CustomChannels.clear()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user