Merge pull request #139 from Kamushy/master

File name will now be name of the question.
pull/296/head
Callum Leslie 3 years ago committed by GitHub
commit 718b005d07
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -2,9 +2,8 @@ from utils.console import print_markdown, print_step, print_substep
from dotenv import load_dotenv from dotenv import load_dotenv
import os, random, praw, re import os, random, praw, re
def get_subreddit_threads(): def get_subreddit_threads():
global submission
""" """
Returns a list of threads from the AskReddit subreddit. Returns a list of threads from the AskReddit subreddit.
""" """

@ -7,6 +7,8 @@ from moviepy.editor import (
CompositeAudioClip, CompositeAudioClip,
CompositeVideoClip, CompositeVideoClip,
) )
import reddit.subreddit
import re
from utils.console import print_step from utils.console import print_step
from dotenv import load_dotenv from dotenv import load_dotenv
import os import os
@ -16,11 +18,13 @@ W, H = 1080, 1920
def make_final_video(number_of_clips): def make_final_video(number_of_clips):
# Calls opacity from the .env
# Calls opacity from the .env
load_dotenv() load_dotenv()
opacity = os.getenv('OPACITY') opacity = os.getenv('OPACITY')
print_step("Creating the final video...") print_step("Creating the final video...")
VideoFileClip.reW = lambda clip: clip.resize(width=W) VideoFileClip.reW = lambda clip: clip.resize(width=W)
VideoFileClip.reH = lambda clip: clip.resize(width=H) VideoFileClip.reH = lambda clip: clip.resize(width=H)
@ -62,9 +66,7 @@ def make_final_video(number_of_clips):
) )
image_concat.audio = audio_composite image_concat.audio = audio_composite
final = CompositeVideoClip([background_clip, image_concat]) final = CompositeVideoClip([background_clip, image_concat])
final.write_videofile( filename = (re.sub('[?\"%*:|<>]', '', ("assets/" + reddit.subreddit.submission.title + ".mp4")))
"assets/final_video.mp4", fps=30, audio_codec="aac", audio_bitrate="192k" final.write_videofile(filename, fps=30, audio_codec="aac", audio_bitrate="192k")
)
for i in range(0, number_of_clips): for i in range(0, number_of_clips):
pass pass

Loading…
Cancel
Save