From 4456777f758a28ac9a7ccc17954cd32dfb856582 Mon Sep 17 00:00:00 2001 From: Mohamed Moataz Date: Thu, 11 Apr 2024 17:39:38 +0200 Subject: [PATCH] Changed reqs --- main.py | 37 +++++++++++++++++++++++-------------- requirements.txt | Bin 5058 -> 5310 bytes 2 files changed, 23 insertions(+), 14 deletions(-) diff --git a/main.py b/main.py index 6864fbc..45f95f3 100755 --- a/main.py +++ b/main.py @@ -1,5 +1,7 @@ #!/usr/bin/env python import math +import os +import shutil import time import schedule import sys @@ -53,6 +55,11 @@ def main(POST_ID=None) -> None: redditid = id(reddit_object) post_text = ' '.join(reddit_object['thread_post']) + if not os.path.exists(f"./assets/temp/{reddit_object['thread_id']}/"): + settings.config["settings"]["debug"]["reuse_images"] = False + settings.config["settings"]["debug"]["reuse_mp3"] = False + settings.config["settings"]["debug"]["reuse_video"] = False + length, number_of_comments = save_text_to_mp3(reddit_object) length = math.ceil(length) reel = length <= 60 @@ -68,20 +75,22 @@ def main(POST_ID=None) -> None: video_path = make_final_video(number_of_comments, length, reddit_object, bg_config, reel) video_path = compress_video(video_path) - # video_data, thumbnail_text = get_video_data(post_text) - # print("Video title:", video_data['title']) - # print("Video description:", video_data['description']) - # print("Video tags:", video_data['tags']) + video_data, thumbnail_text = get_video_data(post_text) + print("Video title:", video_data['title']) + print("Video description:", video_data['description']) + print("Video tags:", video_data['tags']) - # thumbnail = generate_image(thumbnail_text, f"./assets/temp/{reddit_object['thread_id']}/thumbnail_image.png") - # thumbnail = "thumbnail.png" - # thumbnail = add_text( - # thumbnail_path=thumbnail, - # text=video_data["thumbnail_text"], - # save_path=f"./assets/temp/{reddit_object['thread_id']}/thumbnail.png" - # ) - # print("Thumbnail generated successfully at:", thumbnail) - # upload_video_to_youtube(video_path, video_data, thumbnail) + thumbnail = generate_image(thumbnail_text, f"./assets/temp/{reddit_object['thread_id']}/thumbnail_image.png") + thumbnail = add_text( + thumbnail_path=thumbnail, + text=video_data["thumbnail_text"], + save_path=f"./assets/temp/{reddit_object['thread_id']}/thumbnail.png" + ) + print("Thumbnail generated successfully at:", thumbnail) + upload_video_to_youtube(video_path, video_data, thumbnail) + + if settings.config["settings"]["debug"]["debug"]: + shutil.rmtree(f"./assets/temp/{reddit_object['thread_id']}/") def run_many(times) -> None: @@ -137,7 +146,7 @@ if __name__ == "__main__": from video_data_generation.gemini import get_video_data from video_data_generation.image_generation import generate_image, add_text - # from utils.youtube_uploader import upload_video_to_youtube + from utils.youtube_uploader import upload_video_to_youtube if ( not settings.config["settings"]["tts"]["tiktok_sessionid"] diff --git a/requirements.txt b/requirements.txt index 9605669d038e2fa7a4ac870b01c113dbfda21a3c..4f1092bb5e0a0039c6d5859c948b189588360dbe 100644 GIT binary patch delta 288 zcmX@4zE5+4hGr^5B10)d2}34B8j#LmC}zk9(gh4A47NaM!l1`s$Y2B{jVCIu6ixz4 zLnI7qrFZ1X&C+8*KSxcD7viBA|nkfin4EIYXeF8Q4*V47?0nK$8*jx{^g&kXKDNzvREk3;9w4n}rz5SSDX$y)pR_Tg>Jjb{}@}0)|Y6av;uQFlI1fumwURAT*wQ bo^L5ot`beon8AR-Y;!(;EaT=k0+*Np&ukc|