Compare commits
2 commits
47add55c5f
...
963c3fb7c1
| Author | SHA1 | Date | |
|---|---|---|---|
| 963c3fb7c1 | |||
| 87ccc3fa59 |
3 changed files with 25 additions and 3 deletions
|
|
@ -2467,7 +2467,7 @@ async def process_endpoint(
|
||||||
detail=f"{name} must be between {lo:g} and {hi:g}")
|
detail=f"{name} must be between {lo:g} and {hi:g}")
|
||||||
return int(val) if integer else val
|
return int(val) if integer else val
|
||||||
|
|
||||||
n_clips = _gen_control(target_clips, "target_clips", 1, 15, integer=True)
|
n_clips = _gen_control(target_clips, "target_clips", 1, 31, integer=True)
|
||||||
min_secs = _gen_control(clip_min_seconds, "clip_min_seconds", 5, 175)
|
min_secs = _gen_control(clip_min_seconds, "clip_min_seconds", 5, 175)
|
||||||
max_secs = _gen_control(clip_max_seconds, "clip_max_seconds", 10, 180)
|
max_secs = _gen_control(clip_max_seconds, "clip_max_seconds", 10, 180)
|
||||||
if min_secs is not None and max_secs is not None and max_secs < min_secs + 5:
|
if min_secs is not None and max_secs is not None and max_secs < min_secs + 5:
|
||||||
|
|
|
||||||
|
|
@ -413,7 +413,7 @@ export default function MediaInput({ onProcess, isProcessing }) {
|
||||||
<div>
|
<div>
|
||||||
<p className="eyebrow mb-1.5">clips to aim for</p>
|
<p className="eyebrow mb-1.5">clips to aim for</p>
|
||||||
<input
|
<input
|
||||||
type="number" min="1" max="15" step="1"
|
type="number" min="1" max="31" step="1"
|
||||||
value={targetClips}
|
value={targetClips}
|
||||||
onChange={(e) => setTargetClips(e.target.value)}
|
onChange={(e) => setTargetClips(e.target.value)}
|
||||||
placeholder="auto"
|
placeholder="auto"
|
||||||
|
|
|
||||||
|
|
@ -261,7 +261,29 @@ async def test_target_clips_validation(client, media_factory):
|
||||||
{"file": ("clip.mp4", media_factory.six.read_bytes(), "video/mp4")},
|
{"file": ("clip.mp4", media_factory.six.read_bytes(), "video/mp4")},
|
||||||
)
|
)
|
||||||
assert out_of_range.status_code == 400
|
assert out_of_range.status_code == 400
|
||||||
assert "target_clips must be between 1 and 15" in out_of_range.json()["detail"]
|
assert "target_clips must be between 1 and 31" in out_of_range.json()["detail"]
|
||||||
|
|
||||||
|
|
||||||
|
async def test_target_clips_accepts_raised_ceiling(
|
||||||
|
client, app_state, media_factory):
|
||||||
|
# The ceiling was raised from 15 to 31; the top of the new band must queue
|
||||||
|
# with the override the selector reads, and 32 must still be rejected.
|
||||||
|
resp = await _submit_file(
|
||||||
|
client,
|
||||||
|
{"acknowledged": "true", "target_clips": "31"},
|
||||||
|
{"file": ("clip.mp4", media_factory.six.read_bytes(), "video/mp4")},
|
||||||
|
)
|
||||||
|
job_id = _job(client, resp)
|
||||||
|
env = app_state.app.jobs[job_id]["env"]
|
||||||
|
assert env["CLIP_TARGET_MIN"] == "31" and env["CLIP_TARGET_MAX"] == "31"
|
||||||
|
|
||||||
|
too_many = await _submit_file(
|
||||||
|
client,
|
||||||
|
{"acknowledged": "true", "target_clips": "32"},
|
||||||
|
{"file": ("clip.mp4", media_factory.six.read_bytes(), "video/mp4")},
|
||||||
|
)
|
||||||
|
assert too_many.status_code == 400
|
||||||
|
assert "target_clips must be between 1 and 31" in too_many.json()["detail"]
|
||||||
|
|
||||||
|
|
||||||
async def test_clip_range_validation(client, media_factory):
|
async def test_clip_range_validation(client, media_factory):
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue