codiga suggestions

pull/280/head
iaacornus 3 years ago
parent 376f30d709
commit a695e74821
No known key found for this signature in database
GPG Key ID: 281739AE7252598C

@ -62,7 +62,7 @@ def main(subreddit_=None, background=None, filename=None, thread_link_=None):
TypeError,
):
console.print(
f"[bold red]Please ensure that OPACITY is between 0 and 1 in .env file.[/bold red]"
"[bold red]Please ensure that OPACITY is between 0 and 1 in .env file.[/bold red]"
)
raise SystemExit()

@ -67,7 +67,7 @@ def get_subreddit_threads(subreddit_, thread_link_):
# he doesn't insert the "RANDOM_THREAD" variable at all, ask the thread link
if thread_link_ is not None:
thread_link = thread_link_
print_step(f"Getting the inserted thread...")
print_step("Getting the inserted thread...")
submission = reddit.submission(url=thread_link)
else:
try:
@ -104,7 +104,7 @@ def get_subreddit_threads(subreddit_, thread_link_):
"comment_id": top_level_comment.id,
}
)
except AttributeError as e:
except AttributeError:
pass
print_substep("AskReddit threads retrieved successfully.", style="bold green")

@ -42,7 +42,7 @@ def setup():
+ " grab those quickly and come back.[/bold]"
)
"""Begin the setup process."""
# Begin the setup process.
cliID = input("Client ID > ")
cliSec = input("Client Secret > ")

@ -40,7 +40,7 @@ def make_final_video(number_of_clips, file_name):
TypeError
):
print_substep(
f"Please ensure that OPACITY is between 0 and 1 in .env file", style="bold red"
"Please ensure that OPACITY is between 0 and 1 in .env file", style="bold red"
)
# Gather all audio clips
@ -50,7 +50,7 @@ def make_final_video(number_of_clips, file_name):
audio_clips.insert(0, AudioFileClip("assets/mp3/title.mp3"))
try:
audio_clips.insert(1, AudioFileClip(f"assets/mp3/posttext.mp3"))
audio_clips.insert(1, AudioFileClip("assets/mp3/posttext.mp3"))
except (
OSError,
FileNotFoundError,
@ -63,10 +63,10 @@ def make_final_video(number_of_clips, file_name):
# Gather all images
image_clips = []
if os.path.exists(f"assets/mp3/posttext.mp3"):
if os.path.exists("assets/mp3/posttext.mp3"):
image_clips.insert(
0,
ImageClip(f"assets/png/title.png")
ImageClip("assets/png/title.png")
.set_duration(audio_clips[0].duration + audio_clips[1].duration)
.set_position("center")
.resize(width=1080 - 100)
@ -75,7 +75,7 @@ def make_final_video(number_of_clips, file_name):
else:
image_clips.insert(
0,
ImageClip(f"assets/png/title.png")
ImageClip("assets/png/title.png")
.set_duration(audio_clips[0].duration)
.set_position("center")
.resize(width=1080 - 100)

@ -25,14 +25,14 @@ def save_text_to_mp3(reddit_obj):
length += MP3("assets/mp3/title.mp3").info.length
try:
Path(f"assets/mp3/posttext.mp3").unlink()
Path("assets/mp3/posttext.mp3").unlink()
except OSError:
pass
if reddit_obj["thread_post"] != "":
tts = gTTS(text=reddit_obj["thread_post"], lang="en", slow=False)
tts.save(f"assets/mp3/posttext.mp3")
length += MP3(f"assets/mp3/posttext.mp3").info.length
tts.save("assets/mp3/posttext.mp3")
length += MP3("assets/mp3/posttext.mp3").info.length
for idx, comment in track(enumerate(reddit_obj["comments"]), "Saving..."):
# ! Stop creating mp3 files if the length is greater than 50 seconds.

Loading…
Cancel
Save