fix(downloads): GIF review round 1 — shape, HDR, caps, audio, copy
- A GIF squares its pixels before the size, so an anamorphic source keeps
its shown shape (a 720x480 DVD at 16:9 was 480x320).
- An editor GIF of an HDR upload is tonemapped, as a clip GIF is.
- The length caps are judged in whole milliseconds: a range exactly at a
cap is no longer refused for a float hair over it.
- A GIF is made of a video only: an audio file is refused with its reason
and the editor offers no GIF for it.
- A GIF clip keeps no audio track: the track neither splits its cache key
nor fails it.
- The editor's GIF notes keep their live region mounted; one size reads
as one ("about 1 MB"), none is shown with nothing kept; the size choices
show their unit; a shared picture that fails to load says so.
- Copy: the two-sentence GIF notes keep their last stop (a copy-rule test
now holds it); the English warns of "only a still picture".
This commit is contained in:
@@ -44,7 +44,13 @@ from app.userscope import owned_by, owned_row
|
||||
# Every reason an edit is refused; the UI names each one (`downloads.errors.edit.<reason>`, held by
|
||||
# the frontend's backendIds contract, which reads this Literal).
|
||||
EditReason = Literal[
|
||||
"source_not_ready", "not_media", "empty_edit", "bad_gif", "gif_range", "gif_too_long"
|
||||
"source_not_ready",
|
||||
"not_media",
|
||||
"empty_edit",
|
||||
"bad_gif",
|
||||
"gif_range",
|
||||
"gif_too_long",
|
||||
"gif_not_video",
|
||||
]
|
||||
|
||||
|
||||
@@ -268,7 +274,7 @@ def _check_gif_edit(spec: dict) -> None:
|
||||
trim = spec.get("trim") or {}
|
||||
if spec.get("segments") or trim.get("end_s") is None:
|
||||
raise EditError("gif_range")
|
||||
if trim["end_s"] - trim.get("start_s", 0.0) > gifmod.MAX_S:
|
||||
if gifmod.too_long(trim.get("start_s", 0.0), trim["end_s"]):
|
||||
raise EditError("gif_too_long", limit_s=gifmod.MAX_S)
|
||||
|
||||
|
||||
@@ -298,6 +304,9 @@ def enqueue_edit(
|
||||
if not spec:
|
||||
raise EditError("empty_edit")
|
||||
if "gif" in (edit_spec or {}):
|
||||
# A GIF is made of the first video stream: audio has none, or only its cover picture.
|
||||
if src_asset.media_kind != mediakind.VIDEO:
|
||||
raise EditError("gif_not_video")
|
||||
_check_gif_edit(spec)
|
||||
|
||||
quota.check_enqueue(db, user_id)
|
||||
|
||||
Reference in New Issue
Block a user