Fix:(Bug)empty string in story mode

pull/1288/head
electro199 3 years ago
parent dabbd04af9
commit f0e5138857

@ -41,8 +41,9 @@ def get_subreddit_threads(POST_ID: str):
check_for_async=False, check_for_async=False,
) )
except ResponseException as e: except ResponseException as e:
if e.response.status_code == 401: match e.response.status_code:
print("Invalid credentials - please check them in config.toml") case 401:
print("Invalid credentials - please check them in config.toml")
except: except:
print("Something went wrong...") print("Something went wrong...")

@ -32,8 +32,8 @@ def imagemaker( theme,
title=reddit_obj['thread_title'] title=reddit_obj['thread_title']
texts=reddit_obj['thread_post'] texts=reddit_obj['thread_post']
id = re.sub(r"[^\w\s-]", "", reddit_obj["thread_id"]) id = re.sub(r"[^\w\s-]", "", reddit_obj["thread_id"])
tfont=ImageFont.truetype("fonts\Roboto-Bold.ttf",27) # for title tfont=ImageFont.truetype("fonts\\Roboto-Bold.ttf",27) # for title
font=ImageFont.truetype("fonts\Roboto-Regular.ttf", 20)# for despcription|comments font=ImageFont.truetype("fonts\\Roboto-Regular.ttf", 20)# for despcription|comments
size=(500,176) size=(500,176)

@ -1,5 +1,6 @@
import re import re
import spacy import spacy
from utils.voice import sanitize_text
#working good #working good
def posttextparser(obj): def posttextparser(obj):
@ -15,10 +16,13 @@ def posttextparser(obj):
doc= nlp(text) doc= nlp(text)
newtext=[] newtext:list = []
# to check for space str
for line in doc.sents: for line in doc.sents:
newtext.append(line.text) if sanitize_text(line.text):
# print(line) newtext.append(line.text)
# print(line)
return newtext return newtext

@ -179,6 +179,8 @@ def make_final_video(
audio_bitrate="192k", audio_bitrate="192k",
verbose=False, verbose=False,
threads=multiprocessing.cpu_count(), threads=multiprocessing.cpu_count(),
# preset="ultrafast" #for testings
) )
ffmpeg_extract_subclip( ffmpeg_extract_subclip(
f"assets/temp/{id}/temp.mp4", f"assets/temp/{id}/temp.mp4",

@ -26,8 +26,11 @@ def download_screenshots_of_reddit_posts(reddit_object: dict, screenshot_num: in
reddit_object (Dict): Reddit object received from reddit/subreddit.py reddit_object (Dict): Reddit object received from reddit/subreddit.py
screenshot_num (int): Number of screenshots to download screenshot_num (int): Number of screenshots to download
""" """
print_step("Downloading screenshots of reddit posts...") print_step("Downloading screenshots of reddit posts...")
id = re.sub(r"[^\w\s-]", "", reddit_object["thread_id"]) id = re.sub(r"[^\w\s-]", "", reddit_object["thread_id"])
# ! Make sure the reddit screenshots folder exists # ! Make sure the reddit screenshots folder exists
Path(f"assets/temp/{id}/png").mkdir(parents=True, exist_ok=True) Path(f"assets/temp/{id}/png").mkdir(parents=True, exist_ok=True)
def download(cookie_file,num=None): def download(cookie_file,num=None):

Loading…
Cancel
Save