Save to correct subreddit folder

pull/1873/head
KyleBoyer 2 years ago
parent 6bc1b9c675
commit cb4ab7f7ab

@ -66,7 +66,7 @@ def main(POST_ID=None) -> None:
def run_many(times) -> None: def run_many(times) -> None:
for x in range(1, times + 1): for x in range(1, times + 1):
print_step( print_step(
f'on the {x}{("th", "st", "nd", "rd", "th", "th", "th", "th", "th", "th")[x % 10]} iteration of {times}' f'{x}{("th", "st", "nd", "rd", "th", "th", "th", "th", "th", "th")[x % 10]} iteration of {times}'
) # correct 1st 2nd 3rd 4th 5th.... ) # correct 1st 2nd 3rd 4th 5th....
main() main()
# Popen("cls" if name == "nt" else "clear", shell=True).wait() # Popen("cls" if name == "nt" else "clear", shell=True).wait()
@ -108,7 +108,7 @@ if __name__ == "__main__":
for index, post_id in enumerate(config["reddit"]["thread"]["post_id"].split("+")): for index, post_id in enumerate(config["reddit"]["thread"]["post_id"].split("+")):
index += 1 index += 1
print_step( print_step(
f'on the {index}{("st" if index % 10 == 1 else ("nd" if index % 10 == 2 else ("rd" if index % 10 == 3 else "th")))} post of {len(config["reddit"]["thread"]["post_id"].split("+"))}' f'{index}{("st" if index % 10 == 1 else ("nd" if index % 10 == 2 else ("rd" if index % 10 == 3 else "th")))} post of {len(config["reddit"]["thread"]["post_id"].split("+"))}'
) )
main(post_id) main(post_id)
# Popen("cls" if name == "nt" else "clear", shell=True).wait() # Popen("cls" if name == "nt" else "clear", shell=True).wait()

@ -124,6 +124,7 @@ def get_subreddit_threads(POST_ID: str):
content["thread_title"] = submission.title content["thread_title"] = submission.title
content["thread_id"] = submission.id content["thread_id"] = submission.id
content["is_nsfw"] = submission.over_18 content["is_nsfw"] = submission.over_18
content['subreddit'] = str(submission.subreddit)
content["comments"] = [] content["comments"] = []
if settings.config["settings"]["storymode"]: if settings.config["settings"]["storymode"]:
ai_selftext = submission.selftext ai_selftext = submission.selftext

@ -3,7 +3,7 @@ botocore==1.29.142
gTTS==2.3.2 gTTS==2.3.2
moviepy==1.0.3 moviepy==1.0.3
playwright==1.34.0 playwright==1.34.0
praw==7.7.0 praw==7.7.1
prawcore~=2.3.0 prawcore~=2.3.0
requests==2.31.0 requests==2.31.0
rich==13.4.1 rich==13.4.1

@ -1,3 +1,3 @@
#!/bin/sh #!/bin/sh
sudo docker run -v $(pwd)/config.toml:/app/config.toml -v $(pwd)/out/:/app/assets -v $(pwd)/.env:/app/.env -v $(pwd)/results:/app/results -it rvmt sudo docker run -v $(pwd)/video_creation/data:/app/video_creation/data -v $(pwd)/config.toml:/app/config.toml -v $(pwd)/out/:/app/assets -v $(pwd)/.env:/app/.env -v $(pwd)/results:/app/results -it rvmt

@ -262,14 +262,14 @@ def make_final_video(
title_thumb = reddit_obj["thread_title"] title_thumb = reddit_obj["thread_title"]
filename = f"{name_normalize(title)[:251]}" filename = f"{name_normalize(title)[:251]}"
subreddit = settings.config["reddit"]["thread"]["subreddit"] subreddit = reddit_obj['subreddit'] # settings.config["reddit"]["thread"]["subreddit"]
if not exists(f"./results/{subreddit}"): if not exists(f"./results/{subreddit}"):
print_substep("The 'results' folder could not be found so it was automatically created.") # print_substep("The 'results' folder could not be found so it was automatically created.")
os.makedirs(f"./results/{subreddit}") os.makedirs(f"./results/{subreddit}")
if not exists(f"./results/{subreddit}/OnlyTTS") and allowOnlyTTSFolder: if not exists(f"./results/{subreddit}/OnlyTTS") and allowOnlyTTSFolder:
print_substep("The 'OnlyTTS' folder could not be found so it was automatically created.") # print_substep("The 'OnlyTTS' folder could not be found so it was automatically created.")
os.makedirs(f"./results/{subreddit}/OnlyTTS") os.makedirs(f"./results/{subreddit}/OnlyTTS")
# create a thumbnail for the video # create a thumbnail for the video
@ -277,9 +277,9 @@ def make_final_video(
if settingsbackground["background_thumbnail"]: if settingsbackground["background_thumbnail"]:
if not exists(f"./results/{subreddit}/thumbnails"): if not exists(f"./results/{subreddit}/thumbnails"):
print_substep( # print_substep(
"The 'results/thumbnails' folder could not be found so it was automatically created." # "The 'results/thumbnails' folder could not be found so it was automatically created."
) # )
os.makedirs(f"./results/{subreddit}/thumbnails") os.makedirs(f"./results/{subreddit}/thumbnails")
# get the first file with the .png extension from assets/backgrounds and use it as a background for the thumbnail # get the first file with the .png extension from assets/backgrounds and use it as a background for the thumbnail
first_image = next( first_image = next(

Loading…
Cancel
Save