Merge branch 'develop' into develop
This commit is contained in:
5 files changed
+59
-7
No files matched your search
@@ -21,6 +21,27 @@ REQUIRED_VALUES = [
|
||||
"OPACITY",
|
||||
]
|
||||
|
||||
# Banner may look bad or wrong in IDE/Text Editor, but looks perfect in CMD, BASH or ZSH
|
||||
banner = '''
|
||||
|
||||
██████╗░███████╗██████╗░██████╗░██╗████████╗ ██╗░░░██╗██╗██████╗░███████╗░█████╗░
|
||||
██╔══██╗██╔════╝██╔══██╗██╔══██╗██║╚══██╔══╝ ██║░░░██║██║██╔══██╗██╔════╝██╔══██╗
|
||||
██████╔╝█████╗░░██║░░██║██║░░██║██║░░░██║░░░ ╚██╗░██╔╝██║██║░░██║█████╗░░██║░░██║
|
||||
██╔══██╗██╔══╝░░██║░░██║██║░░██║██║░░░██║░░░ ░╚████╔╝░██║██║░░██║██╔══╝░░██║░░██║
|
||||
██║░░██║███████╗██████╔╝██████╔╝██║░░░██║░░░ ░░╚██╔╝░░██║██████╔╝███████╗╚█████╔╝
|
||||
╚═╝░░╚═╝╚══════╝╚═════╝░╚═════╝░╚═╝░░░╚═╝░░░ ░░░╚═╝░░░╚═╝╚═════╝░╚══════╝░╚════╝░
|
||||
|
||||
███╗░░░███╗░█████╗░██╗░░██╗███████╗██████╗░
|
||||
████╗░████║██╔══██╗██║░██╔╝██╔════╝██╔══██╗
|
||||
██╔████╔██║███████║█████═╝░█████╗░░██████╔╝
|
||||
██║╚██╔╝██║██╔══██║██╔═██╗░██╔══╝░░██╔══██╗
|
||||
██║░╚═╝░██║██║░░██║██║░╚██╗███████╗██║░░██║
|
||||
╚═╝░░░░░╚═╝╚═╝░░╚═╝╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝
|
||||
|
||||
'''
|
||||
print(banner)
|
||||
time.sleep(0.5)
|
||||
|
||||
print_markdown(
|
||||
"### Thanks for using this tool! [Feel free to contribute to this project on GitHub!](https://lewismenelaws.com) If you have any questions, feel free to reach out to me on Twitter or submit a GitHub issue."
|
||||
)
|
||||
@@ -39,7 +60,7 @@ reddit2fa = os.getenv("REDDIT_2FA")
|
||||
load_dotenv()
|
||||
|
||||
console.log("[bold green]Checking environment variables...")
|
||||
time.sleep(1)
|
||||
time.sleep(.5)
|
||||
|
||||
if not os.path.exists(".env"):
|
||||
configured = False
|
||||
|
||||
@@ -63,6 +63,16 @@ def get_subreddit_threads():
|
||||
|
||||
print_substep(f"Video will be: {submission.title}")
|
||||
print("Getting video comments...")
|
||||
|
||||
upvotes = submission.score
|
||||
ratio = submission.upvote_ratio * 100
|
||||
num_comments = submission.num_comments
|
||||
|
||||
console.log(f"[bold green] Video will be: {submission.title} :thumbsup:")
|
||||
console.log(f"[bold blue] Thread has " + str(upvotes) + " upvotes")
|
||||
console.log(f"[bold blue] Thread has a upvote ratio of " + str(ratio) + "%")
|
||||
console.log(f"[bold blue] Thread has " + str(num_comments) + " comments")
|
||||
console.log("Getting video comments...")
|
||||
|
||||
try:
|
||||
content["thread_url"] = submission.url
|
||||
|
||||
@@ -46,6 +46,14 @@ def make_final_video(number_of_clips):
|
||||
OSError()
|
||||
audio_concat = concatenate_audioclips(audio_clips)
|
||||
audio_composite = CompositeAudioClip([audio_concat])
|
||||
|
||||
#Get sum of all clip lengths
|
||||
total_length = sum([clip.duration for clip in audio_clips])
|
||||
#round total_length to an integer
|
||||
int_total_length=round(total_length)
|
||||
#Output Length
|
||||
console.log(f"[bold green] Video Will Be: {int_total_length} Seconds Long")
|
||||
|
||||
|
||||
# Gather all images
|
||||
image_clips = []
|
||||
|
||||
@@ -4,6 +4,8 @@ from pathlib import Path
|
||||
from rich.progress import track
|
||||
from utils.console import print_step, print_substep
|
||||
import json
|
||||
from rich.console import Console
|
||||
console = Console()
|
||||
|
||||
|
||||
def download_screenshots_of_reddit_posts(reddit_object, screenshot_num, theme):
|
||||
@@ -48,9 +50,12 @@ def download_screenshots_of_reddit_posts(reddit_object, screenshot_num, theme):
|
||||
)
|
||||
|
||||
for idx, comment in track(
|
||||
enumerate(reddit_object["comments"]), "Downloading screenshots..."
|
||||
enumerate(reddit_object["comments"])
|
||||
):
|
||||
|
||||
#allow user to see what comment is being saved
|
||||
print_substep(f"Downloading screenshot {idx + 1}")
|
||||
|
||||
# Stop if we have reached the screenshot_num
|
||||
if idx >= screenshot_num:
|
||||
break
|
||||
@@ -62,5 +67,7 @@ def download_screenshots_of_reddit_posts(reddit_object, screenshot_num, theme):
|
||||
page.locator(f"#t1_{comment['comment_id']}").screenshot(
|
||||
path=f"assets/png/comment_{idx}.png"
|
||||
)
|
||||
|
||||
print_substep("Screenshots downloaded Successfully.", style="bold green")
|
||||
|
||||
#let user know that the screenshots are done
|
||||
console.log(f"[bold green]Saved {idx + 1} screenshots.")
|
||||
|
||||
@@ -4,9 +4,10 @@ from pathlib import Path
|
||||
from mutagen.mp3 import MP3
|
||||
from utils.console import print_step, print_substep
|
||||
from rich.progress import track
|
||||
from rich.console import Console
|
||||
console = Console()
|
||||
import re
|
||||
|
||||
|
||||
def save_text_to_mp3(reddit_obj):
|
||||
"""Saves Text to MP3 files.
|
||||
|
||||
@@ -33,7 +34,11 @@ def save_text_to_mp3(reddit_obj):
|
||||
tts.save("assets/mp3/posttext.mp3")
|
||||
length += MP3("assets/mp3/posttext.mp3").info.length
|
||||
|
||||
for idx, comment in track(enumerate(reddit_obj["comments"]), "Saving..."):
|
||||
for idx, comment in track(enumerate(reddit_obj["comments"])):
|
||||
|
||||
#allow user to see what comment is being saved
|
||||
print_substep(f"Saving MP3 {idx + 1} ")
|
||||
|
||||
# ! Stop creating mp3 files if the length is greater than 50 seconds. This can be longer, but this is just a good starting point
|
||||
if length > 50:
|
||||
break
|
||||
@@ -43,6 +48,7 @@ def save_text_to_mp3(reddit_obj):
|
||||
tts.save(f"assets/mp3/{idx}.mp3")
|
||||
length += MP3(f"assets/mp3/{idx}.mp3").info.length
|
||||
|
||||
print_substep("Saved Text to MP3 files successfully.", style="bold green")
|
||||
#let user know that the MP3 files are saved
|
||||
console.log(f"[bold green]Saved {idx + 1} MP3 Files.")
|
||||
# ! Return the index so we know how many screenshots of comments we need to make.
|
||||
return length, idx
|
||||
Reference in new issue
Block a user