basyx commited on
Commit
64412b1
·
verified ·
1 Parent(s): f29ebb0

feat: add unified media inspection endpoint

Browse files
Files changed (1) hide show
  1. app/api/media.py +14 -0
app/api/media.py CHANGED
@@ -27,6 +27,20 @@ async def execute_operation(request: Request, name: str, operation: Operation) -
27
  return await processor.run(resolved, name, operation)
28
 
29
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
  async def stream_file(path: Path) -> AsyncIterator[bytes]:
31
  async with aiofiles.open(path, "rb") as media:
32
  while chunk := await media.read(1024 * 1024):
 
27
  return await processor.run(resolved, name, operation)
28
 
29
 
30
+ @router.post("/v1/media/inspect", response_model=SuccessResponse, name="inspect_media")
31
+ async def inspect_media(request: Request) -> SuccessResponse:
32
+ """Inspect uploaded or remotely referenced media without transforming it.
33
+
34
+ Accepts the same multipart, JSON URL/Base64, n8n binary, and raw-body
35
+ inputs as processing endpoints. The shared resolver and FFprobe validation
36
+ keep this endpoint's behavior consistent with the processing pipeline.
37
+ """
38
+ request.state.operation = "media.inspect"
39
+ processor = get_processor(request)
40
+ resolved = await processor.resolver.resolve(request)
41
+ return await processor.probe(resolved)
42
+
43
+
44
  async def stream_file(path: Path) -> AsyncIterator[bytes]:
45
  async with aiofiles.open(path, "rb") as media:
46
  while chunk := await media.read(1024 * 1024):