Merge pull request #1 from HallowedDust5/ConsistentPathLibUse

Consistent path lib use
pull/507/head
HallowedDust5 3 years ago committed by GitHub
commit c2b0591846
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -11,6 +11,7 @@ from video_creation.screenshot_downloader import download_screenshots_of_reddit_
from video_creation.final_video import make_final_video
from utils.loader import Loader
from dotenv import load_dotenv
from pathlib import Path
console = Console()
from dotenv import load_dotenv
@ -48,8 +49,7 @@ load_dotenv()
console.log("[bold green]Checking environment variables...")
time.sleep(1)
if not os.path.exists(".env"):
if not Path(".env").is_file():
configured = False
console.log("[red] Your .env file is invalid, or was never created. Standby.")

@ -12,10 +12,10 @@ from utils.console import print_step
from utils.console import print_substep
from rich.console import Console
from utils.loader import Loader
from os.path import exists
from pathlib import Path
console = Console()
setup_done = exists(".setup-done-before")
setup_done = Path(".setup-done-before").is_file()
if setup_done == True:
console.log("[red]Setup was already completed! Please make sure you have to run this script again. If you have to, please delete the file .setup-done-before")

@ -12,6 +12,7 @@ import re
from utils.console import print_step
from dotenv import load_dotenv
import os
from pathlib import Path
W, H = 1080, 1920
@ -57,7 +58,7 @@ def make_final_video(number_of_clips):
.resize(width=W - 100)
.set_opacity(float(opacity)),
)
if os.path.exists(f"assets/mp3/posttext.mp3"):
if Path(f"assets/mp3/posttext.mp3").is_file():
image_clips.insert(
0,
ImageClip(f"assets/png/title.png")
@ -80,7 +81,11 @@ def make_final_video(number_of_clips):
)
image_concat.audio = audio_composite
final = CompositeVideoClip([background_clip, image_concat])
filename = (re.sub('[?\"%*:|<>]', '', ("assets/" + reddit.subreddit.submission.title + ".mp4")))
final.write_videofile(filename, fps=30, audio_codec="aac", audio_bitrate="192k")
for i in range(0, number_of_clips):
pass
if not Path("assets/generated-videos").is_dir():
Path.mkdir("assets/generated-videos")
raw_filename = Path("assets", "generated-videos") / (reddit.subreddit.submission.title + ".mp4")
cleaned_filename = (re.sub('[?\"%*:|<>]', '', str(raw_filename)))
final.write_videofile(cleaned_filename, fps=30, audio_codec="aac", audio_bitrate="192k")
Loading…
Cancel
Save