iaacornus 3 years ago
commit 3d41ed20a2
No known key found for this signature in database
GPG Key ID: 281739AE7252598C

@ -32,12 +32,22 @@ def program_options():
help="Use another video background for video (accepts link).",
action="store"
)
parser.add_argument(
"-f",
"--filename",
help="Set a filename for the video.",
action="store"
)
args = parser.parse_args()
try:
if args.create:
main(args.subreddit, args.background)
main(
args.subreddit,
args.background,
args.filename
)
else:
print_substep("Error occured!", style="bold red")
raise SystemExit()

@ -12,7 +12,7 @@ from video_creation.final_video import make_final_video
from utils.console import print_markdown, print_substep
def main(subreddit_=None, background=None):
def main(subreddit_=None, background=None, filename=None):
REQUIRED_VALUES = [
"REDDIT_CLIENT_ID",
"REDDIT_CLIENT_SECRET",
@ -42,7 +42,10 @@ def main(subreddit_=None, background=None):
if configured:
reddit_object = get_subreddit_threads(subreddit_)
length, number_of_comments = save_text_to_mp3(reddit_object)
download_screenshots_of_reddit_posts(reddit_object, number_of_comments, os.getenv("THEME"))
download_screenshots_of_reddit_posts(
reddit_object, number_of_comments,
os.getenv("THEME")
)
download_background(background)
chop_background_video(length)
final_video = make_final_video(number_of_comments)
final_video = make_final_video(snumber_of_comments, filename)

@ -19,7 +19,7 @@ from utils.console import print_step
W, H = 1080, 1920
def make_final_video(number_of_clips):
def make_final_video(number_of_clips, file_name):
# Calls opacity from the .env
load_dotenv()
opacity = os.getenv('OPACITY')
@ -80,9 +80,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"))
)
if file_name is None:
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

Loading…
Cancel
Save