Fixing some stuff

pull/2041/head
cyteon 1 year ago
parent c2355af25b
commit 7c31473d96

@ -93,7 +93,7 @@ class TTSEngine:
self.call_tts(f"postaudio-{idx}", process_text(text))
else:
os.makedirs("assets/temp/" + self.redditid + "/png")
os.makedirs("assets/temp/" + self.redditid + "/png", exist_ok=True)
for idx, comment in track(enumerate(self.reddit_object["comments"]), "Saving..."):
# ! Stop creating mp3 files if the length is greater than max length.
if self.length > self.max_length and idx > 1:
@ -107,6 +107,7 @@ class TTSEngine:
else: # If the comment is not too long, just call the tts engine
self.call_tts(f"{idx}", process_text(comment["comment_body"]))
# TODO: Maybe move this somewhere better?
comment_image_maker((0, 0, 0, 0), self.reddit_object, comment["comment_body"], idx, (255, 255, 255), transparent=True)
print_substep("Saved Text to MP3 files successfully.", style="bold green")

@ -16,6 +16,8 @@ def draw_multiple_line_text(
"""
Draw multiline text over given image
"""
# TODO: Optimize code for comments
draw = ImageDraw.Draw(image)
Fontperm = font.getsize(text)
image_width, image_height = image.size
@ -25,10 +27,7 @@ def draw_multiple_line_text(
line_width, line_height = font.getsize(line)
if transparent:
shadowcolor = "black"
for i in range(
1,
5 if settings.config["storymode"] else 8 # 5 was the normal value but increased to 8 for stuff like askreddit due to clipping
):
for i in range(1, 5):
draw.text(
((image_width - line_width) / 2 - i, y - i),
line,

Loading…
Cancel
Save