ismdrobiul489 commited on
Commit
795b7e9
·
1 Parent(s): 071c8d3

Fix: Correct chunk duration key, add detailed scene/chunk logging

Browse files
Files changed (1) hide show
  1. modules/art_reels/router.py +18 -6
modules/art_reels/router.py CHANGED
@@ -219,13 +219,25 @@ async def generate_stick_figure_video(job_id: str, script: str, voice: str):
219
  pro_stick = ProfessionalStickFigure()
220
  scenes = pro_stick.generate_scenes_with_ai(chunks)
221
 
222
- # Calculate durations for each chunk
 
 
 
 
 
 
 
 
 
 
 
 
 
 
223
  chunk_durations = []
224
- for i, chunk in enumerate(chunks):
225
- if i < len(chunks) - 1:
226
- duration = chunks[i + 1].get("start_time", 2.0) - chunk.get("start_time", 0)
227
- else:
228
- duration = audio_duration - chunk.get("start_time", 0)
229
  chunk_durations.append(max(0.5, duration))
230
 
231
  update_job(job_id, "processing", 60)
 
219
  pro_stick = ProfessionalStickFigure()
220
  scenes = pro_stick.generate_scenes_with_ai(chunks)
221
 
222
+ # Log scenes for debugging
223
+ logger.info(f"AI generated {len(scenes)} scenes for {len(chunks)} chunks")
224
+ for i, s in enumerate(scenes):
225
+ scene_info = f"Scene {i}: type={s.get('scene_type', 'unknown')}"
226
+ if s.get('characters'):
227
+ poses = [c.get('pose', 'unknown') for c in s['characters']]
228
+ scene_info += f", poses={poses}"
229
+ logger.info(scene_info)
230
+
231
+ # Log chunks for debugging
232
+ logger.info(f"Chunks from SRTParser: {len(chunks)}")
233
+ for i, c in enumerate(chunks):
234
+ logger.info(f"Chunk {i}: text='{c.get('text', '')[:30]}...', duration={c.get('duration', 2.0)}s")
235
+
236
+ # Calculate durations for each chunk (SRTParser provides 'duration' in seconds)
237
  chunk_durations = []
238
+ for chunk in chunks:
239
+ # SRTParser.create_2s_chunks returns 'duration' key in seconds
240
+ duration = chunk.get('duration', 2.0)
 
 
241
  chunk_durations.append(max(0.5, duration))
242
 
243
  update_job(job_id, "processing", 60)