fix fish weight calculation by using correct parameters. output video

This commit is contained in:
zaiun xu
2026-04-14 20:55:15 +08:00
parent 8497d0eb1d
commit af67f61b63
520 changed files with 4450241 additions and 337 deletions

View File

@@ -6,6 +6,7 @@ from fastapi import APIRouter, Depends, Header, Query
from starlette.responses import JSONResponse
from app.db import normalize_client_id, pop_next_health, pop_next_measure
from app.services.sonar_video import get_sonar_video_public_url
from app.services.water_video import get_water_video_public_url
from app.settings import Settings, get_settings
@@ -66,15 +67,20 @@ async def get_real_camera(
},
headers=_new_headers(True),
)
payload: dict = {
"result": m.result,
"video_left": m.video_left,
"video_right": m.video_right,
}
if m.calculation_log:
payload["calculation_log"] = m.calculation_log
return JSONResponse(
content={
"code": 200,
"msg": "成功",
"data": {
"result": m.result,
"video_left": m.video_left,
"video_right": m.video_right,
},
"data": payload,
},
headers=_new_headers(True),
)
@@ -153,14 +159,18 @@ async def get_water_video(
@router.get("/sonar/video/")
async def get_sonar_video():
"""声纳图像信息:当前返回空 `video_path`;后续将提供 H.264 编码 MP4 的绝对 URL。"""
async def get_sonar_video(
settings: Settings = Depends(get_settings),
client_id: str = Depends(_resolve_client_id),
):
"""声呐视频:与水面相同经 ffmpeg 转 H.264 后托管在 /media/;整段一个文件,每次返回同一 `video_path` URL。"""
video_path = await get_sonar_video_public_url(settings, client_id)
return JSONResponse(
content={
"code": 200,
"msg": "成功",
"data": {
"video_path": "",
"video_path": video_path,
},
},
)

View File

@@ -0,0 +1,18 @@
"""调试接口(仅开发/排障;生产环境请按需限制访问)。"""
from __future__ import annotations
from fastapi import APIRouter, Depends
from app.db import list_all_measure_snapshots
from app.settings import Settings, get_settings
router = APIRouter(prefix="/api/v1/debug", tags=["debug"])
@router.get("/meause")
@router.get("/measure")
async def debug_list_measure_results(settings: Settings = Depends(get_settings)):
"""列出 SQLite 中已保存的全部 FishMeasure 计算结果(含每条鱼的 result / pred / star 等)。"""
items = list_all_measure_snapshots(settings)
return {"count": len(items), "items": items}