Update app.py
Browse files
app.py
CHANGED
@@ -177,7 +177,7 @@ def write_google(google_translate):
|
|
177 |
def time_to_seconds(time_obj):
|
178 |
return time_obj.hours * 3600 + time_obj.minutes * 60 + time_obj.seconds + time_obj.milliseconds / 1000
|
179 |
|
180 |
-
def create_subtitle_clips(subtitles, videosize, fontsize
|
181 |
subtitle_clips = []
|
182 |
for subtitle in subtitles:
|
183 |
start_time = time_to_seconds(subtitle.start)
|
@@ -186,7 +186,7 @@ def create_subtitle_clips(subtitles, videosize, fontsize=32, font="arial.ttf", c
|
|
186 |
video_width, video_height = videosize
|
187 |
reshaped_text = arabic_reshaper.reshape(subtitle.text)
|
188 |
bidi_text = get_display(reshaped_text)
|
189 |
-
text_clip = TextClip(bidi_text, fontsize=fontsize, font=
|
190 |
subtitle_x_position = 'center'
|
191 |
subtitle_y_position = video_height * 4 / 5
|
192 |
text_position = (subtitle_x_position, subtitle_y_position)
|
|
|
177 |
def time_to_seconds(time_obj):
|
178 |
return time_obj.hours * 3600 + time_obj.minutes * 60 + time_obj.seconds + time_obj.milliseconds / 1000
|
179 |
|
180 |
+
def create_subtitle_clips(subtitles, videosize, fontsize, fon, color, debug):
|
181 |
subtitle_clips = []
|
182 |
for subtitle in subtitles:
|
183 |
start_time = time_to_seconds(subtitle.start)
|
|
|
186 |
video_width, video_height = videosize
|
187 |
reshaped_text = arabic_reshaper.reshape(subtitle.text)
|
188 |
bidi_text = get_display(reshaped_text)
|
189 |
+
text_clip = TextClip(bidi_text, fontsize=fontsize, font=fon, color=color, bg_color='black', size=(video_width*3/4, None), method='label', align='West').set_start(start_time).set_duration(duration)
|
190 |
subtitle_x_position = 'center'
|
191 |
subtitle_y_position = video_height * 4 / 5
|
192 |
text_position = (subtitle_x_position, subtitle_y_position)
|