INNER CODE UNIT · Python
normalize_output_mode
liuzhao1225/YouDub-webui · backend/app/main.py:325
def normalize_output_mode(value: str) -> str:
try:
return database.normalize_output_mode(value)
except ValueError as exc:
raise HTTPException(status_code=422, detail=str(exc)) from exc
@app.post("/api/tasks", status_code=201)
def create_task(payload: TaskCreate) -> dict:
try:
validated_url = validate_video_url(payload.url)
except ValueError as exc:
raise HTTPException(status_code=422, detail=str(exc)) from exc
normalized_execution_mode = normalize_execution_mode(payload.execution_mode)
normalized_output_mode = normalize_output_mode(payload.output_mode)
existing_id = database.find_task_by_video_id(
validated_url.video_id,