sunilchm commited on
Commit
5d3f3ca
·
1 Parent(s): 48199ea

add .mov file format

Browse files
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -327,7 +327,10 @@ async def update_frame_status(frame_id: int, payload: dict = Body(...)):
327
  async def upload_video(background_tasks: BackgroundTasks, location: str = Form(None), category: str = Form(...), city: str = Form(...), file: UploadFile = File(...)):
328
  if not file.content_type.startswith('video/'):
329
  raise HTTPException(status_code=400, detail="File is not a video.")
330
- video_data = await file.read()
 
 
 
331
  video_guid = str(uuid.uuid4())
332
  lat, lon = get_gps_location(file.file)
333
  location_point = f"Point({lon:.6f} {lat:.6f})" if lat and lon else None
@@ -345,8 +348,9 @@ async def upload_video(background_tasks: BackgroundTasks, location: str = Form(N
345
  print(f"variancevalue: {getvariancevalue}")
346
  print(f"category: {category}")
347
  print(f"Step2")
348
- """
349
  print(f"city: {city}")
 
 
350
  background_tasks.add_task(process_video_in_background, video_data, video_guid, file.filename, location_point, location, is_approved, getvariancevalue, category, city)
351
  return {"message": "Video upload successful. Processing has started.", "video_guid": video_guid}
352
 
 
327
  async def upload_video(background_tasks: BackgroundTasks, location: str = Form(None), category: str = Form(...), city: str = Form(...), file: UploadFile = File(...)):
328
  if not file.content_type.startswith('video/'):
329
  raise HTTPException(status_code=400, detail="File is not a video.")
330
+ video_data = await file.read()
331
+ # Extract extension from uploaded file (fallback to .mp4)
332
+ _, ext = os.path.splitext(file.filename)
333
+ ext = ext.lower() if ext.lower() in [".mp4", ".mov"] else ".mp4"
334
  video_guid = str(uuid.uuid4())
335
  lat, lon = get_gps_location(file.file)
336
  location_point = f"Point({lon:.6f} {lat:.6f})" if lat and lon else None
 
348
  print(f"variancevalue: {getvariancevalue}")
349
  print(f"category: {category}")
350
  print(f"Step2")
 
351
  print(f"city: {city}")
352
+ """
353
+ print(f"file extension: {ext}")
354
  background_tasks.add_task(process_video_in_background, video_data, video_guid, file.filename, location_point, location, is_approved, getvariancevalue, category, city)
355
  return {"message": "Video upload successful. Processing has started.", "video_guid": video_guid}
356