From fae742971cde91226f766832dc2125ec26c1438d Mon Sep 17 00:00:00 2001 From: Pauljd Date: Tue, 3 Nov 2026 11:49:48 +0000 Subject: [PATCH] 0.84.1: when the best copy of a show has nothing playable here, try its other copies Co-Authored-By: Claude Opus 5.5 (1M context) --- android/app/build.gradle.kts | 4 ++-- .../app/src/main/java/tv/orbit/classic/EmbyClient.kt | 2 +- .../java/tv/orbit/classic/EmbyPlaybackProtocol.kt | 11 +++++++++-- .../java/tv/orbit/classic/SecureMediaDataSource.kt | 2 +- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/android/app/build.gradle.kts b/android/app/build.gradle.kts index ef3ef507..a43f640a 100644 --- a/android/app/build.gradle.kts +++ b/android/app/build.gradle.kts @@ -9,8 +9,8 @@ android { applicationId = "tv.orbit.classic" minSdk = 26 targetSdk = 36 - versionCode = 102 - versionName = "0.84.0-paradox" + versionCode = 103 + versionName = "0.84.1-other-copies" } buildFeatures { compose = true } compileOptions { sourceCompatibility = JavaVersion.VERSION_17; targetCompatibility = JavaVersion.VERSION_17 } diff --git a/android/app/src/main/java/tv/orbit/classic/EmbyClient.kt b/android/app/src/main/java/tv/orbit/classic/EmbyClient.kt index 654838e4..5b1dc67d 100644 --- a/android/app/src/main/java/tv/orbit/classic/EmbyClient.kt +++ b/android/app/src/main/java/tv/orbit/classic/EmbyClient.kt @@ -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.84.0\"") + connection.setRequestProperty("X-Emby-Authorization", "Emby Client=\"Orbit TV\", Device=\"Orbit TV\", DeviceId=\"$deviceId\", Version=\"0.84.1\"") request.token?.let { connection.setRequestProperty("X-Emby-Token", it) } if (request.method == "POST") { val bytes = request.body.orEmpty().toByteArray(Charsets.UTF_8) diff --git a/android/app/src/main/java/tv/orbit/classic/EmbyPlaybackProtocol.kt b/android/app/src/main/java/tv/orbit/classic/EmbyPlaybackProtocol.kt index 1348c661..136f9bc1 100644 --- a/android/app/src/main/java/tv/orbit/classic/EmbyPlaybackProtocol.kt +++ b/android/app/src/main/java/tv/orbit/classic/EmbyPlaybackProtocol.kt @@ -207,8 +207,15 @@ internal class EmbySampleSession(private val transport: EmbyTransport, private v val match = bestSeriesMatch(search, if (programming.exactTitles) candidates.filter { seriesKey(it.title) == seriesKey(search) } else candidates) ?: continue // A second copy of a show in the library counts as the same show. if (pool.any { it.id == match.id || seriesKey(it.title) == seriesKey(match.title) }) continue - val whole = readWholeSeries(transport, userId, ::currentToken, match, checkActive, onRequest = { requests++ }, canDecode = BoxDecoders::canDecode, englishAudio = programming.englishAudio) - if (whole.episodes.isNotEmpty()) pool += whole + // If the best copy has nothing this box can play, another copy of the same show may. + val copies = listOf(match) + candidates.filter { it.id != match.id && seriesKey(it.title) == seriesKey(match.title) }.sortedBy { it.year ?: Int.MAX_VALUE } + for ((tried, copy) in copies.withIndex()) { + val whole = readWholeSeries(transport, userId, ::currentToken, copy, checkActive, onRequest = { requests++ }, canDecode = BoxDecoders::canDecode, englishAudio = programming.englishAudio) + if (whole.episodes.isEmpty()) continue + pool += whole + if (tried > 0) android.util.Log.i("OrbitSchedule", "channel=${programming.number} usedCopy=${tried + 1} of ${copies.size}") + break + } } for (accepted in choices.accepted) { checkActive() diff --git a/android/app/src/main/java/tv/orbit/classic/SecureMediaDataSource.kt b/android/app/src/main/java/tv/orbit/classic/SecureMediaDataSource.kt index e0774d57..1ac0cba5 100644 --- a/android/app/src/main/java/tv/orbit/classic/SecureMediaDataSource.kt +++ b/android/app/src/main/java/tv/orbit/classic/SecureMediaDataSource.kt @@ -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.84.0") + next.setRequestProperty("User-Agent", "OrbitTV/0.84.1") 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()) {