VeuReu commited on
Commit
ae2abb0
·
verified ·
1 Parent(s): afe1310

Update main_process/main_router.py

Browse files
Files changed (1) hide show
  1. main_process/main_router.py +28 -4
main_process/main_router.py CHANGED
@@ -100,8 +100,8 @@ def generate_srt_from_segments(segments: List[Dict], sha1: str) -> str:
100
  video_root = MEDIA_ROOT / sha1
101
  video_root.mkdir(parents=True, exist_ok=True)
102
 
103
- # Path: /data/media/<sha1>/srt
104
- srt_dir = video_root / "srt"
105
  srt_dir.mkdir(parents=True, exist_ok=True)
106
 
107
  # Delete old SRT files
@@ -308,5 +308,29 @@ async def pipeline_video_analysis(
308
  # Generate the final SRT subtitle file
309
  srt = generate_srt_from_segments(info_clips, sha1)
310
 
311
- # The endpoint returns the SRT file as plain text
312
- return srt
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
100
  video_root = MEDIA_ROOT / sha1
101
  video_root.mkdir(parents=True, exist_ok=True)
102
 
103
+ # Path: /data/media/<sha1>/origin_srt
104
+ srt_dir = video_root / "initial_srt"
105
  srt_dir.mkdir(parents=True, exist_ok=True)
106
 
107
  # Delete old SRT files
 
308
  # Generate the final SRT subtitle file
309
  srt = generate_srt_from_segments(info_clips, sha1)
310
 
311
+ # Create result JSON
312
+ result_json = {
313
+ "full_transcription": full_transcription,
314
+ "info_escenas": info_escenas,
315
+ "info_clips": info_clips
316
+ }
317
+
318
+ # Path: /data/media/<sha1>
319
+ video_root = MEDIA_ROOT / sha1
320
+ video_root.mkdir(parents=True, exist_ok=True)
321
+
322
+ # Path: /data/media/<sha1>/origin_srt
323
+ srt_dir = video_root / "initial_srt"
324
+ srt_dir.mkdir(parents=True, exist_ok=True)
325
+
326
+ final_path = srt_dir / "initial_info.json"
327
+
328
+ with final_path.open("w", encoding="utf-8") as f:
329
+ json.dump({
330
+ "full_transcription": full_transcription,
331
+ "info_escenas": info_escenas,
332
+ "info_clips": info_clips
333
+ }, f, ensure_ascii=False, indent=4)
334
+
335
+ # The endpoint returns OK message info
336
+ return {"status": "ok", "message": "Initial SRT and info JSON generated"}