fix: don't scale or crop timelines when opening a saved file (#453)#555
Merged
azfoo merged 3 commits intoJul 24, 2026
Merged
Conversation
Collaborator
Author
|
@azfoo, sorry for the dealy on opening, but this one is important. The bug is very annoying. Ideally to be landed on the next minor version. I didn't test the AI fix. |
Collaborator
|
@FelipeDefensor will do, no worries. do also see the last email I sent you. |
…eAnnotator#453) Opening a .tla sets the media duration twice: first from the file's stored media length, then again when the player reports the actual duration. For YouTube these two values often differ by a fraction of a second, so TiLiA prompted to scale timelines that already matched the saved media. Route the file-open media load through a new scale_timelines="keep" mode that updates the duration without scaling, cropping, or prompting. "no" is not enough: it still crops when the reported duration comes back shorter, which silently deletes end components. "keep" leaves the timelines untouched -- correct on open, since they were saved to match this media. Explicit "Load Media" actions keep the default "prompt". Add a regression test covering both a shorter and a longer async duration reported after open, asserting no scale prompt and no component loss.
It is possible to edit the same video with the same id and cut it significantly shorter. This can cause problems further down if the new media duration is saved with elements that are now well beyond the end time. Rather than assuming that the time difference is always due to a small error, limit the potential for major differences.
azfoo
force-pushed
the
fix/453-keep-timelines-on-open
branch
from
July 24, 2026 13:53
e1da2e4 to
05cd95a
Compare
also adds a --scale-timelines option in the cli
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #453.
Problem
Opening a
.tlasets the media duration twice: first from the file's storedmedia length, then again when the player reports the actual duration. For YouTube sources these two values usually differ by a fraction of a second, so TiLiA prompted the user to scale timelines that already matched the saved media.Fix
Route the file-open media load through a new
scale_timelines="keep"mode. On open, the timelines were saved to match this media, so the duration the player reports must not scale, crop, or prompt — it should only update the stored duration."keep"rather than"no":"no"still crops when the reported duration comes back shorter than the stored value (App.on_media_duration_changed), which silently deletes any components past the new end. YouTube's asynchronous duration can be a few milliseconds shorter than the stored value, so"no"risked data loss. Explicit Load Media actions keep the default"prompt", and the media-not-found → replacement-media path on open also keeps"prompt".Test
test_async_duration_after_open_does_not_prompt_or_change_timelines— parametrized over a shorter and a longer async duration reported after open; asserts no scale prompt fires and no component is scaled or cropped. Built withsave_and_reopen(a real temporary.tla). Verified it fails under"no"(the end marker is cropped:assert 0 == 1) and passes under"keep".Test plan
pytest tests/test_app.py::TestFileLoad tests/test_app.py::TestScaleCropTimeline tests/test_app.py::TestMediaLoad(22 passed)🤖 Generated with Claude Code