Update app.py
Browse files
app.py
CHANGED
@@ -284,9 +284,9 @@ def read_srt_file(file_path):
|
|
284 |
|
285 |
def clean_text(text):
|
286 |
# Remove 'srt ' from the start of each line
|
287 |
-
text = re.sub(r'^srt ', '', text, flags=re.MULTILINE)
|
288 |
# Remove ''' from the start and end
|
289 |
-
text = re.sub(r"
|
290 |
return text
|
291 |
|
292 |
def enhance_text(api_key, text, google):
|
@@ -353,7 +353,7 @@ def create_subtitle_clips(subtitles, videosize, fontsize, font, color, debug):
|
|
353 |
#bidi_text = get_display(reshaped_text)
|
354 |
text_clip = TextClip(font, subtitle.text, font_size=fontsize, size=(int(video_width * 0.8), int(video_height * 0.2)) ,text_align="center" ,color=color, bg_color='black', method='caption').with_start(start_time).with_duration(duration)
|
355 |
subtitle_x_position = 'center'
|
356 |
-
subtitle_y_position = video_height * 0.
|
357 |
text_position = (subtitle_x_position, subtitle_y_position)
|
358 |
subtitle_clips.append(text_clip.with_position(text_position))
|
359 |
return subtitle_clips
|
|
|
284 |
|
285 |
def clean_text(text):
|
286 |
# Remove 'srt ' from the start of each line
|
287 |
+
#text = re.sub(r'^srt ', '', text, flags=re.MULTILINE)
|
288 |
# Remove ''' from the start and end
|
289 |
+
text = re.sub(r"^```srt|```$", '', text)
|
290 |
return text
|
291 |
|
292 |
def enhance_text(api_key, text, google):
|
|
|
353 |
#bidi_text = get_display(reshaped_text)
|
354 |
text_clip = TextClip(font, subtitle.text, font_size=fontsize, size=(int(video_width * 0.8), int(video_height * 0.2)) ,text_align="center" ,color=color, bg_color='black', method='caption').with_start(start_time).with_duration(duration)
|
355 |
subtitle_x_position = 'center'
|
356 |
+
subtitle_y_position = video_height * 0.72
|
357 |
text_position = (subtitle_x_position, subtitle_y_position)
|
358 |
subtitle_clips.append(text_clip.with_position(text_position))
|
359 |
return subtitle_clips
|