
    )i                     l    d dl Z d dlmZ d dlmZmZ d dlmZ  ej                  d      d        Zd Z	y)	    N)Path)chainchord)celeryzvideo_main.merge_mcq)namec                    | \  }}|j                  d      }|j                  d      }|j                  d      xs |j                  d      }|st        d      |r|st        d      t        d|        t        d|        |||dS )	zBMerge results from previous tasks (PPT + Audio) before video sync.pdf_pathaudio_mapping_fileidzQBoth ppt_result and audio_result must include 'id' key for session identificationzUppt_result must include 'pdf_path' and audio_result must include 'audio_mapping_file'u   📁 PDF Path: u   🎵 Audio Mapping File: )r	   r
   r   )get
ValueErrorprint)results
ppt_resultaudio_resultr	   r
   
session_ids         4C:\xampp\htdocs\eduruby\Video_generation\mcq_main.py	merge_mcqr   
   s      'J~~j)H%))*>?%?)9)9$)?Jlmm-pqq	OH:
&'	%&8%9
:; 8JR\]]    c                    ddl m} ddlm} ddlm} ddlm} t        d       t        d|       t        d|       t        d	|       t        d
|       d}t        d|        t        d       |j                  |       j                  |      }|j                         j                  |      }	|j                         j                  |      }
t        j                         j                  |      }|j                  |      j                  |      }t        |t        |	|
g|      |      j                         }t        d|        t        d       |S )u  
    Run the full MCQ pipeline:
      1️⃣ Extract MCQs and create slides.json
      2️⃣ Create PPT from slides.json
      3️⃣ Generate audio (uses internal VOICE_ID from audio_generation.py)
      4️⃣ Merge results
      5️⃣ Sync PPT + Audio + Avatar into video
    r   )generate_mcq_content)create_mcq_ppt) generate_audio_from_presentation)pdf_audio_map_to_videozDEBUG TASK SIGNATURES:z - MCQ:z - PPT:z	 - AUDIO:z	 - VIDEO:video_serialu0   
🚀 Launching MCQ Video Pipeline for session: z<------------------------------------------------------------)queue)avatar_pathu.   ✅ [Pipeline Started] Celery job queued for: zcCheck Celery worker logs for progress.
------------------------------------------------------------)Video_generation.MCQ_creatorr   "Video_generation.mcq_ppt_generatorr   !Video_generation.audio_conversionr   Video_generation.Video_syncr   r   ssetr   r   r   apply_async)r	   r   r   r   r   r   r   SERIAL_QUEUEgen_mcq_taskppt_task
audio_task
merge_task
video_task
work_chains                 r   run_mcq_pipeliner,       sK    BARB	
"#	))*	)^$	+78	+-.!L	=j\
JK	
HI ())(377l7KL !%%L%9H 2335999MJ """6J ())k)BFF\FZJ x$j1 km	  
::,
GH	
pqr   )
jsonpathlibr   r   r   r   
celery_apptaskr   r,    r   r   <module>r2      s8        ()^ *^*2r   