Your channels play in the sound they have; planning is shown, not silent
Channels of your own no longer leave out episodes without English sound: Sakura's anime is mostly Japanese with subtitles, and its first read was finding almost nothing to play. The phone says how long a new channel's first plan takes, Your channels shows Planning… until it's done, and the TV's switch says when it is still planning another channel instead of doing nothing. 0.108.91. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -99,6 +99,11 @@ internal object CustomChannels {
|
||||
fun clear() { list = emptyList() }
|
||||
fun nextNumber(): Int? = (YOURS_FIRST..YOURS_LAST).firstOrNull { n -> list.none { it.number == n } }
|
||||
fun of(number: Int) = list.firstOrNull { it.number == number }
|
||||
/** The channel of your own whose first week is being planned right now, if any, for the phone to show. */
|
||||
@Volatile var planning: Int? = null
|
||||
|
||||
/** Roughly how long a first plan takes, from what it has to read: each series' episodes, a quick look for each film. */
|
||||
fun planMinutes(series: Int, films: Int) = ((series * 9 + films) / 60.0).let { kotlin.math.ceil(it).toInt() }.coerceAtLeast(1)
|
||||
|
||||
@Volatile private var cached: Pair<List<CustomChannel>, List<ChannelProgramming>> = emptyList<CustomChannel>() to emptyList()
|
||||
/** Every channel of your own as the planner sees it. */
|
||||
@@ -117,6 +122,9 @@ internal fun programmingOf(channel: CustomChannel): ChannelProgramming = Channel
|
||||
channel.number, channel.name, emptyList(), seriesCount = 60,
|
||||
finishTogether = channel.style == PlayStyle.Standard || channel.style == PlayStyle.Blocks || channel.style == PlayStyle.Shaped,
|
||||
exactTitles = true, shuffleEpisodes = channel.style == PlayStyle.Shuffled, mixedTurns = true,
|
||||
// You chose these titles yourself, so they play in the sound they have: Sakura's anime is mostly Japanese with subtitles,
|
||||
// and asking for English sound left nearly all of it out (7 November 2026).
|
||||
englishAudio = false,
|
||||
dayParts = when (channel.style) { PlayStyle.Blocks -> timetableParts(channel.shows); PlayStyle.Shaped -> shapedParts(channel.slots); else -> emptyList() },
|
||||
storyGrouping = channel.style == PlayStyle.Standard || channel.style == PlayStyle.Shaped,
|
||||
shorts = if (channel.style == PlayStyle.Standard || channel.style == PlayStyle.Shaped) YoursShorts else null,
|
||||
|
||||
@@ -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.90\"") +
|
||||
ServerKind.Emby -> mapOf("X-Emby-Authorization" to "Emby Client=\"Orbit TV\", Device=\"Orbit TV\", DeviceId=\"$deviceId\", Version=\"0.108.91\"") +
|
||||
(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.90\"" +
|
||||
ServerKind.Jellyfin -> mapOf("Authorization" to "MediaBrowser Client=\"Orbit TV\", Device=\"Orbit TV\", DeviceId=\"$deviceId\", Version=\"0.108.91\"" +
|
||||
(token?.let { ", Token=\"$it\"" } ?: ""))
|
||||
}
|
||||
/** One picture from the provider, or nothing. Same fixed origin and no redirects, and failures are never shown or logged. */
|
||||
|
||||
@@ -504,10 +504,13 @@ internal fun EmbyConnectionScreen(modifier: Modifier = Modifier, visible: Boolea
|
||||
fun setSmartSchedule(programming: ChannelProgramming, turnOn: Boolean) {
|
||||
val active = session ?: return
|
||||
val existing = smartLoop(programming)
|
||||
// Planning another channel: say so, rather than the switch seeming to do nothing (Paul, 7 November 2026).
|
||||
if (busy) { message = "Orbit is still planning ${CustomChannels.planning?.let { CustomChannels.of(it)?.name } ?: "another channel"}. Try again when it's finished."; return }
|
||||
// A second press straight after the first is taken as a slip.
|
||||
if (busy || now - lastSmartPress < 5_000) return
|
||||
if (now - lastSmartPress < 5_000) return
|
||||
lastSmartPress = now
|
||||
busy = true; busyLabel = "Reading ${programming.name}'s whole series and planning seven days…"; message = null
|
||||
if (turnOn && CustomChannels.of(programming.number) != null) CustomChannels.planning = programming.number
|
||||
job = scope.launch {
|
||||
try {
|
||||
if (turnOn) {
|
||||
@@ -529,7 +532,7 @@ internal fun EmbyConnectionScreen(modifier: Modifier = Modifier, visible: Boolea
|
||||
} catch (cancelled: CancellationException) { throw cancelled }
|
||||
catch (failure: EmbyCheckException) { withContext(Dispatchers.IO) { scheduler.setEnabled(active.accountId, programming.number, false) }; message = failure.message }
|
||||
catch (_: Exception) { withContext(Dispatchers.IO) { scheduler.setEnabled(active.accountId, programming.number, false) }; message = "${programming.name} could not be scheduled, so it stays off." }
|
||||
finally { busy = false }
|
||||
finally { busy = false; CustomChannels.planning = null }
|
||||
}
|
||||
}
|
||||
// Create your own from a phone and the Companion: kept here, before any screen returns early, so the phone can make
|
||||
@@ -570,7 +573,9 @@ internal fun EmbyConnectionScreen(modifier: Modifier = Modifier, visible: Boolea
|
||||
}
|
||||
android.util.Log.i("OrbitSchedule", "yours channel=${channel.number} style=${channel.style} titles=${shows.size}")
|
||||
SmartChannels.firstOrNull { it.number == channel.number }?.let { setSmartSchedule(it, true) }
|
||||
"${channel.name} is ready on ${channel.number}. Its first programmes are being planned now."
|
||||
val minutes = CustomChannels.planMinutes(shows.count { it.type == "Series" }, shows.count { it.type != "Series" })
|
||||
"${channel.name} is on ${channel.number}. Orbit is reading its titles and planning the week, which takes about " +
|
||||
(if (minutes == 1) "a minute" else "$minutes minutes") + ". It comes on by itself, and you can watch anything else meanwhile."
|
||||
},
|
||||
remove = { number ->
|
||||
val gone = CustomChannels.of(number) ?: return@ChannelMaker "That channel has already gone."
|
||||
|
||||
@@ -294,7 +294,8 @@ internal object PhoneLink {
|
||||
val h = standIn ?: handler ?: return json(out, 403, JSONObject().put("error", "The TV isn't signed in to a library right now."))
|
||||
when ("${r.method} ${r.path}") {
|
||||
"GET /api/channels" -> json(out, 200, JSONObject().put("next", CustomChannels.nextNumber() ?: JSONObject.NULL).put("channels", JSONArray(CustomChannels.list.map { c ->
|
||||
c.toJson().put("on", h.isOn(c.number)).put("styleTitle", c.style.title).put("hoursLabel", c.hours?.label ?: "All day") })))
|
||||
c.toJson().apply { remove("seen") }.put("on", h.isOn(c.number)).put("planning", CustomChannels.planning == c.number)
|
||||
.put("styleTitle", c.style.title).put("hoursLabel", c.hours?.label ?: "All day") })))
|
||||
"GET /api/shows" -> {
|
||||
val number = r.query["number"]?.toIntOrNull() ?: return json(out, 400, JSONObject())
|
||||
json(out, 200, JSONArray(runBlocking { h.maker.showsOf(number) }.map(::suggestionJson)))
|
||||
@@ -389,7 +390,8 @@ internal object PhoneLink {
|
||||
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())
|
||||
val said = runBlocking { withContext(mainDispatcher) { h.maker.create(laidOut, shows) } }
|
||||
json(out, 200, JSONObject().put("message", said).put("number", number))
|
||||
json(out, 200, JSONObject().put("message", said).put("number", number)
|
||||
.put("minutes", CustomChannels.planMinutes(shows.count { it.type == "Series" }, shows.count { it.type != "Series" })))
|
||||
}
|
||||
// Off keeps a channel and its place; on plans it again (Paul, 7 November 2026: an Off switch beside Remove).
|
||||
"POST /api/channels/power" -> {
|
||||
|
||||
@@ -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.90")
|
||||
next.setRequestProperty("User-Agent", "OrbitTV/0.108.91")
|
||||
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