Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ datapoint filters [--country C] [--region R] [--city K] [--postal P]
Every read command supports `--json` for machine-readable output you can pipe
into `jq` or another tool.

Video uploads accept browser-compatible H.264 MP4/MOV or VP8/VP9 WebM files.
The API validates the actual media bytes before storage and reports unsupported,
unreadable, or temporarily unprobeable videos directly in the CLI.

## How `survey create` works

`survey create` reserves credits and dispatches paid human work within seconds —
Expand Down
6 changes: 6 additions & 0 deletions src/datapoint/formatting.py
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,12 @@ def describe_media_error(detail) -> str:
return f"unsupported file type ({ext})" if ext else "unsupported file type"
if code == "media_type_mismatch":
return "file contents do not match its extension"
if code == "unsupported_video_format":
return str(detail.get("message") or "unsupported video format (use H.264 MP4/MOV or VP8/VP9 WebM)")
if code == "invalid_video":
return str(detail.get("message") or detail.get("reason") or "invalid or unreadable video")
if code == "video_validation_unavailable":
return str(detail.get("message") or "video format validation is temporarily unavailable; please retry")
if code == "invalid_svg":
reason = detail.get("reason")
return f"invalid SVG: {reason}" if reason else "invalid SVG"
Expand Down
12 changes: 12 additions & 0 deletions tests/test_formatting.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,18 @@ def test_describe_media_error_codes():
assert f.describe_media_error("plain string") == "plain string"


def test_describe_video_validation_errors():
unsupported = {
"code": "unsupported_video_format",
"message": "Unsupported video codec: hevc. Supported: h264.",
}
assert f.describe_media_error(unsupported) == unsupported["message"]
assert f.describe_media_error({"code": "invalid_video", "reason": "The file is not a readable video."}) == (
"The file is not a readable video."
)
assert "temporarily unavailable" in f.describe_media_error({"code": "video_validation_unavailable"})


def test_render_report_statuses():
assert "not started" in f.render_report({"job_id": "j", "status": "not_started"}).lower()
assert "generating" in f.render_report({"job_id": "j", "status": "generating"}).lower()
Expand Down
Loading