diff --git a/android/app/build.gradle.kts b/android/app/build.gradle.kts index 61f04382..a8f50d79 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 = 228 - versionName = "0.108.68-slower-chase" + versionCode = 229 + versionName = "0.108.69-saturday-mornings" } buildFeatures { compose = true } // The finished build for the TVs (Paul, 6 November 2026: the test build stuttered on the box). Not debuggable, so diff --git a/android/app/src/main/java/tv/orbit/classic/BlockIdents.kt b/android/app/src/main/java/tv/orbit/classic/BlockIdents.kt index edca1b17..2705ef62 100644 --- a/android/app/src/main/java/tv/orbit/classic/BlockIdents.kt +++ b/android/app/src/main/java/tv/orbit/classic/BlockIdents.kt @@ -52,8 +52,13 @@ internal val BlockIdents: Map = mapOf( "orbit2.spooky" to BlockIdent(R.raw.block_orbit2_spooky, R.raw.block_orbit2_spooky_sting), "ringx.ppv" to BlockIdent(R.raw.block_ringx_ppv, R.raw.block_ringx_ppv_sting, BlockOverlay.TonightsEvent), "terra.sunday" to BlockIdent(R.raw.block_terra_sunday, R.raw.block_terra_sunday_sting), + // Saturday Mornings (Paul, 6 November 2026): the weekend cartoons on Heroes, Orbit X and Rewind; Sundays read SUNDAY. + SATURDAY_MORNINGS to BlockIdent(R.raw.block_saturday_mornings, R.raw.block_saturday_mornings_sting), ) + RingXNights.keys.associateWith { BlockIdent(R.raw.block_ringx_nights, R.raw.block_ringx_nights_sting, BlockOverlay.RingXNight) } +internal const val SATURDAY_MORNINGS = "saturday.mornings" +private val SundayMornings = BlockIdent(R.raw.block_sunday_mornings, R.raw.block_saturday_mornings_sting) + /** Orbit's own names for Ring X's weekly nights (approved 3 November 2026), and each night's rope colour. */ internal val RingXNights: Map> get() = mapOf( "ringx.monday" to ("MONDAY NIGHT WARS" to 0xFFE81C30), "ringx.tuesday" to ("TUESDAY TITLE FIGHT" to 0xFFFFC21E), @@ -65,7 +70,9 @@ internal val RingXNights: Map> get() = mapOf( * anything else, including the second programme inside the same block, gets the channel's ident (null). */ internal fun blockIdentFor(current: SampleBroadcast, next: SampleBroadcast, enabled: Boolean): BlockIdent? = - if (!enabled || next.presentation.isEmpty() || next.presentation == current.presentation) null else BlockIdents[next.presentation] + if (!enabled || next.presentation.isEmpty() || next.presentation == current.presentation) null + else if (next.presentation == SATURDAY_MORNINGS && java.time.Instant.ofEpochMilli(next.startMs).atZone(java.time.ZoneId.systemDefault()).dayOfWeek == java.time.DayOfWeek.SUNDAY) SundayMornings + else BlockIdents[next.presentation] /** A programme title made fit for a lower third: the guide's own clean title, or nothing if there isn't one. */ internal fun eventTitle(next: SampleBroadcast): String? = guideTitleParts(next.media.item.title).first.trim().takeIf { it.isNotEmpty() } diff --git a/android/app/src/main/java/tv/orbit/classic/ChannelIdentities.kt b/android/app/src/main/java/tv/orbit/classic/ChannelIdentities.kt index 6610f94e..d08cfc2f 100644 --- a/android/app/src/main/java/tv/orbit/classic/ChannelIdentities.kt +++ b/android/app/src/main/java/tv/orbit/classic/ChannelIdentities.kt @@ -182,8 +182,9 @@ private val HeroesMarvel = listOf("X-Men: The Animated Series", "Spider-Man: The private val HeroesAfterSchool = listOf("Batman: The Animated Series", "Superman: The Animated Series", "Batman Beyond", "Justice League", "Justice League Unlimited", "Static Shock", "Teen Titans") internal val HeroesShows get() = (HeroesCore + HeroesSupporting).distinct() internal val HeroesDayParts get() = listOf( - DayPart(7, 11, HeroesMarvel, days = setOf(DayOfWeek.SATURDAY)), - DayPart(7, 11, HeroesSaturday, days = setOf(DayOfWeek.SUNDAY)), + // Saturday Mornings' ident as the weekend cartoons begin (Paul, 6 November 2026); the key names the ident only. + DayPart(7, 11, HeroesMarvel, days = setOf(DayOfWeek.SATURDAY), key = SATURDAY_MORNINGS), + DayPart(7, 11, HeroesSaturday, days = setOf(DayOfWeek.SUNDAY), key = SATURDAY_MORNINGS), DayPart(6, 15, HeroesShows), DayPart(15, 18, HeroesAfterSchool), DayPart(18, 22, HeroesCore + listOf("Young Justice", "The Avengers: Earth's Mightiest Heroes", "The Spectacular Spider-Man")), DayPart(22, 6, HeroesShows)) /** Self-contained episodes mix. Shows with story arcs stay in order. */ @@ -201,8 +202,8 @@ private val OrbitXGuests = listOf("X-Men: The Animated Series", "Spider-Man: The private val OrbitXEarlierNames = listOf("Digimon Adventure", "Mighty Morphin Power Rangers", "G.I. Joe: A Real American Hero") internal val OrbitXShows get() = (OrbitXCore + OrbitXSupporting + OrbitXGuests + OrbitXEarlierNames).distinct() internal val OrbitXDayParts get() = listOf( - DayPart(7, 12, OrbitXCore + OrbitXEarlierNames + OrbitXGuests, days = setOf(DayOfWeek.SATURDAY)), - DayPart(7, 12, OrbitXSaturday, days = setOf(DayOfWeek.SUNDAY)), + DayPart(7, 12, OrbitXCore + OrbitXEarlierNames + OrbitXGuests, days = setOf(DayOfWeek.SATURDAY), key = SATURDAY_MORNINGS), + DayPart(7, 12, OrbitXSaturday, days = setOf(DayOfWeek.SUNDAY), key = SATURDAY_MORNINGS), DayPart(15, 18, OrbitXCore + OrbitXEarlierNames + OrbitXGuests, days = Weekdays), DayPart(6, 18, OrbitXCore + OrbitXSupporting + OrbitXEarlierNames), DayPart(18, 23, OrbitXShows), DayPart(23, 6, OrbitXCore + OrbitXSupporting + OrbitXEarlierNames)) internal val OrbitXMixed get() = setOf("Biker Mice from Mars", "Teenage Mutant Ninja Turtles", "The Transformers", "He-Man and the Masters of the Universe", "ThunderCats", @@ -220,7 +221,7 @@ private val RewindSupporting = listOf("Rugrats", "Hey Arnold!", "Doug", "CatDog" private val RewindNewer = listOf("Regular Show", "Gravity Falls") internal val RewindShows get() = (RewindCore + RewindSupporting + RewindNewer).distinct() internal val RewindDayParts get() = listOf( - DayPart(7, 12, RewindSaturday, days = Weekend), + DayPart(7, 12, RewindSaturday, days = Weekend, key = SATURDAY_MORNINGS), DayPart(6, 9, RewindCore + listOf("Rugrats", "Hey Arnold!", "Doug")), DayPart(9, 15, RewindShows), DayPart(15, 19, RewindCore), DayPart(19, 23, RewindShows), DayPart(23, 6, RewindCore)) internal val RewindMixed get() = RewindShows.toSet() - "Gravity Falls" 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 21efbd6e..04fe1737 100644 --- a/android/app/src/main/java/tv/orbit/classic/EmbyClient.kt +++ b/android/app/src/main/java/tv/orbit/classic/EmbyClient.kt @@ -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 = when (kind) { - ServerKind.Emby -> mapOf("X-Emby-Authorization" to "Emby Client=\"Orbit TV\", Device=\"Orbit TV\", DeviceId=\"$deviceId\", Version=\"0.108.68\"") + + ServerKind.Emby -> mapOf("X-Emby-Authorization" to "Emby Client=\"Orbit TV\", Device=\"Orbit TV\", DeviceId=\"$deviceId\", Version=\"0.108.69\"") + (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.68\"" + + ServerKind.Jellyfin -> mapOf("Authorization" to "MediaBrowser Client=\"Orbit TV\", Device=\"Orbit TV\", DeviceId=\"$deviceId\", Version=\"0.108.69\"" + (token?.let { ", Token=\"$it\"" } ?: "")) } /** One picture from the provider, or nothing. Same fixed origin and no redirects, and failures are never shown or logged. */ diff --git a/android/app/src/main/java/tv/orbit/classic/InstallSnapshot.kt b/android/app/src/main/java/tv/orbit/classic/InstallSnapshot.kt index f18af259..c1a11c5e 100644 --- a/android/app/src/main/java/tv/orbit/classic/InstallSnapshot.kt +++ b/android/app/src/main/java/tv/orbit/classic/InstallSnapshot.kt @@ -13,6 +13,7 @@ import java.security.MessageDigest * - `snapshot`: copies the schedules and settings into Orbit's own folder on shared storage, with the library's and * sign-in's checksums, for adb to pull and compare. Nothing is read out of them here. * - `rollback `: copies the schedules aside as schedule-rollback-, as every install does. + * - `catalogue`: a read-only copy of the library catalogue beside it, for checking new channels' titles against the library. * - `clear`: removes the copy once it's been pulled. * * It only ever copies; it never changes the schedules, the library or the sign-in. @@ -48,6 +49,12 @@ internal object InstallSnapshot { aside.deleteRecursively(); schedule.copyRecursively(aside, overwrite = true) "aside ${aside.walk().count { it.isFile }}" } + "catalogue" -> { + val db = File(data, "no_backup/catalogue.db") + if (!db.exists()) return "no catalogue" + db.copyTo(File(out, "catalogue.db"), overwrite = true) + "copied catalogue" + } "clear" -> { out.deleteRecursively(); "cleared" } else -> "unknown" } 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 ac47aa33..418d5991 100644 --- a/android/app/src/main/java/tv/orbit/classic/SecureMediaDataSource.kt +++ b/android/app/src/main/java/tv/orbit/classic/SecureMediaDataSource.kt @@ -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.68") + next.setRequestProperty("User-Agent", "OrbitTV/0.108.69") 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()) { diff --git a/android/app/src/main/res/raw/block_saturday_mornings.mp4 b/android/app/src/main/res/raw/block_saturday_mornings.mp4 new file mode 100644 index 00000000..2b24ae5a Binary files /dev/null and b/android/app/src/main/res/raw/block_saturday_mornings.mp4 differ diff --git a/android/app/src/main/res/raw/block_saturday_mornings_sting.m4a b/android/app/src/main/res/raw/block_saturday_mornings_sting.m4a new file mode 100644 index 00000000..e099e7d8 Binary files /dev/null and b/android/app/src/main/res/raw/block_saturday_mornings_sting.m4a differ diff --git a/android/app/src/main/res/raw/block_sunday_mornings.mp4 b/android/app/src/main/res/raw/block_sunday_mornings.mp4 new file mode 100644 index 00000000..fe12952b Binary files /dev/null and b/android/app/src/main/res/raw/block_sunday_mornings.mp4 differ diff --git a/android/app/src/test/java/tv/orbit/classic/PresentationTest.kt b/android/app/src/test/java/tv/orbit/classic/PresentationTest.kt index 21aeadeb..bf02de14 100644 --- a/android/app/src/test/java/tv/orbit/classic/PresentationTest.kt +++ b/android/app/src/test/java/tv/orbit/classic/PresentationTest.kt @@ -19,8 +19,9 @@ class PresentationTest { @Test fun everyApprovedBlockKeyHasItsIdent() { // Takeovers (6 November 2026) have their own drawn ident instead of a filmed one. val keys = SmartChannels.flatMap { it.dayParts }.map { it.key }.filter { it.isNotEmpty() }.toSet() - Takeovers.map { it.key }.toSet() - // Riot 3, After Dark 3, Horror, Gold, Three, Vortex 4 (Movie Night, Prime, Afterburn and its premiere), Orbit 2 2, Ring X 7 (six nights and PPV), Terra. - assertEquals(23, keys.size) + // Riot 3, After Dark 3, Horror, Gold, Three, Vortex 4 (Movie Night, Prime, Afterburn and its premiere), Orbit 2 2, Ring X 7 (six nights and PPV), Terra, + // and Saturday Mornings, shared by Heroes, Orbit X and Rewind. + assertEquals(24, keys.size) assertEquals(emptySet(), keys - BlockIdents.keys) assertTrue(keys.all { PRESENTATION_KEY.matches(it) }) } @@ -115,4 +116,12 @@ class PresentationTest { val long = "NJPW Dominion 6.9 in Osaka-jo Hall and a very long subtitle that runs on" assertEquals(long, eventTitle(broadcast("ringx.ppv", long))) } + + @Test fun saturdayMorningsReadsSundayOnSundays() { + val sunday = java.time.LocalDate.of(2026, 11, 8).atTime(7, 0).atZone(java.time.ZoneId.systemDefault()).toInstant().toEpochMilli() + val saturday = sunday - 24 * 60 * 60_000L + fun at(ms: Long, key: String) = SampleBroadcast(ScheduledMedia(SampleItem("Show / S1 E1 / One", "Episode", 30, "", "i", 30 * 60_000L), "c", 30 * 60_000L), ms, key) + assertEquals(R.raw.block_saturday_mornings, blockIdentFor(at(saturday - 1, ""), at(saturday, SATURDAY_MORNINGS), true)?.video) + assertEquals(R.raw.block_sunday_mornings, blockIdentFor(at(sunday - 1, ""), at(sunday, SATURDAY_MORNINGS), true)?.video) + } }