Update video2.py
Browse files
video2.py
CHANGED
@@ -21,9 +21,7 @@ for path in [BASE_DIR, AUDIO_DIR, CLIPS_DIR]:
|
|
21 |
|
22 |
|
23 |
# Generate audio
|
24 |
-
|
25 |
-
def video_func(id,lines):
|
26 |
-
print(id,lines[id])
|
27 |
tts = gTTS(text=lines[id], lang='en', slow=False)
|
28 |
audio_name = "audio"+str(id)+".mp3"
|
29 |
audio_path=os.path.join(AUDIO_DIR,audio_name)
|
@@ -31,6 +29,12 @@ def video_func(id,lines):
|
|
31 |
if os.path.exists(audio_path):
|
32 |
audio = MP3(audio_path)
|
33 |
duration = audio.info.length
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
IMAGE_PATH = os.path.join(IMAGE_DIR,f"slide{id}.png") # Ensure this path is correct
|
35 |
VIDEO_DURATION = duration # seconds
|
36 |
HIGHLIGHT_COLOR = (255, 255, 0) # Yellow highlight
|
|
|
21 |
|
22 |
|
23 |
# Generate audio
|
24 |
+
def audio_func(id,lines):
|
|
|
|
|
25 |
tts = gTTS(text=lines[id], lang='en', slow=False)
|
26 |
audio_name = "audio"+str(id)+".mp3"
|
27 |
audio_path=os.path.join(AUDIO_DIR,audio_name)
|
|
|
29 |
if os.path.exists(audio_path):
|
30 |
audio = MP3(audio_path)
|
31 |
duration = audio.info.length
|
32 |
+
return duration
|
33 |
+
|
34 |
+
# --- CONFIGURATION ---
|
35 |
+
def video_func(id,lines):
|
36 |
+
print(id,lines[id])
|
37 |
+
duration = audio_func(id,lines)
|
38 |
IMAGE_PATH = os.path.join(IMAGE_DIR,f"slide{id}.png") # Ensure this path is correct
|
39 |
VIDEO_DURATION = duration # seconds
|
40 |
HIGHLIGHT_COLOR = (255, 255, 0) # Yellow highlight
|