Listed titles found by exact identity

Lists now name 11 series as the server does (Horrible Histories (2009), Castle (2009), Lost,
Oz, Rome, Yellowstone (2018), House of Cards (BBC), The Office (BBC), Hunted (Channel 4),
Impossible Engineering (UK), Ben & Holly's Little Kingdom), each checked to be the only series
of that name. 21 films that share a name get their year and the server's IMDb ID. Hunter x
Hunter waits: the server has two different series under one name.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-23 16:18:40 +00:00
co-authored by Claude Opus 5.5
parent 73673cda1a
commit 899a214d09
7 changed files with 70 additions and 32 deletions
@@ -0,0 +1,36 @@
package tv.orbit.classic
import org.json.JSONArray
import org.json.JSONObject
import org.junit.Assert.assertEquals
import org.junit.Assert.assertNull
import org.junit.Assert.assertTrue
import org.junit.Test
/** Listed titles found by their exact identity (Paul, 23 November 2026): never a remake, sequel or another film of the name. */
class NameFixesTest {
private fun copy(id: String, name: String, year: Int, imdb: String) = FilmCandidate(id, name, year, imdb,
listOf(JSONObject().put("Id", "ms$id").put("Container", "mkv").put("RunTimeTicks", 100 * 60 * 10_000_000L)
.put("MediaStreams", JSONArray().put(JSONObject().put("Type", "Video").put("Codec", "h264")))))
@Test fun aliensIsTheFilmItMeans() {
val tv = copy("5452400", "Aliens", 1982, "tt0675188"); val film = copy("5451915", "Aliens", 1986, "tt0090605")
assertNull(resolveFilm(FilmIdentity.of("Aliens"), listOf(tv, film)).film)
assertEquals("5451915", resolveFilm(FilmIdentity.of("Aliens (1986)"), listOf(tv, film)).film?.id)
}
@Test fun copiesTaggedWithDifferentYearsAreStillOneFilm() {
// The Toxic Avenger's two copies carry 1984 and 1985, with the same IMDb ID; the 2023 remake is never taken for it.
val a = copy("5435922", "The Toxic Avenger", 1984, "tt0090190"); val b = copy("5450078", "The Toxic Avenger", 1985, "tt0090190")
val remake = copy("5437601", "The Toxic Avenger", 2023, "tt1633359")
val found = resolveFilm(FilmIdentity.of("The Toxic Avenger (1984)"), listOf(remake, a, b)).film
assertTrue(found?.id in setOf("5435922", "5450078"))
}
@Test fun theListsNameTheServersSeries() {
val names = SmartChannels.flatMap { p -> p.searches + p.dayParts.flatMap { it.titles } }.toSet()
listOf("Horrible Histories (2009)", "Castle (2009)", "Lost", "Oz", "Rome", "Yellowstone (2018)", "House of Cards", "The Office", "Hunted (2015)",
"Impossible Engineering (UK)", "Ben & Holly's Little Kingdom", "Aliens (1986)", "Let It Snow (2019)", "Soul (2020)").forEach { assertTrue(it, it in names) }
listOf("Lost (2004)", "Hunted (2012)", "Aliens", "Soul").forEach { assertTrue(it, it !in names) }
}
}