A booked film the scan re-filed under a new number plays again
Scream 2 still wouldn't open on the VPS: the TV asked for item 3866244, which the first scan had removed (Emby answers 500 for a gone item), while the film lives on under a new number. On a 404 or 500, openBooked looks the film up once by its exact title (findFilm), plays that copy in the same slot, updates the saved plan (PlanEdits.replace) and re-times it for its own length. Films only; no extra reads otherwise. Server errors now carry their HTTP status. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -137,6 +137,29 @@ class ProgrammeLengthsTest {
|
||||
assertNull(retimedPlan(once, 0, 101 * min))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun aRefiledFilmTakesTheSameSlotAndIsThenTimedForItsOwnLength() {
|
||||
// 12 November 2026: the scan re-filed Scream 2 under a new number. The copy found keeps the slot, then re-times.
|
||||
val dir = kotlin.io.path.createTempDirectory("refiled").toFile()
|
||||
try {
|
||||
val store = ScheduleStore(dir)
|
||||
val p = plan(entry("old1", 0, 120 * min), entry("next1", 120 * min, 30 * min))
|
||||
store.savePlan("u1", 304, p)
|
||||
val channel = ScheduledChannel(SampleChannel(listOf(entry("loop1", 0, 30 * min).media, entry("loop2", 0, 30 * min).media), "Horror", 304), p)
|
||||
val copy = entry("new1", 0, 120 * min + 14_000).media
|
||||
PlanEdits.replace(channel, store, "u1", 0, "old1", copy)
|
||||
assertEquals("new1", channel.plan.entries[0].media.item.id)
|
||||
assertEquals(120 * min, channel.plan.entries[0].media.durationMs)
|
||||
assertEquals("new1", store.loadPlan("u1", 304)!!.entries[0].media.item.id)
|
||||
// Then its own length: 14 seconds longer, so what follows moves.
|
||||
assertEquals(1, PlanEdits.retime(channel, store, "u1", 0, 120 * min + 14_000))
|
||||
assertEquals(120 * min + 14_000, channel.plan.entries[1].startMs)
|
||||
// A different booked file at that time is left alone.
|
||||
PlanEdits.replace(channel, store, "u1", 0, "someoneelse", entry("x1", 0, min).media)
|
||||
assertEquals("new1", channel.plan.entries[0].media.item.id)
|
||||
} finally { dir.deleteRecursively() }
|
||||
}
|
||||
|
||||
@Test
|
||||
fun aReTimedPlanSavesAndLoads() {
|
||||
val dir = kotlin.io.path.createTempDirectory("lengths").toFile()
|
||||
|
||||
Reference in New Issue
Block a user