Merge pull request #503 from JasonLovesDoggo/master

fixes desyncing
pull/524/head
Jason 2 years ago committed by GitHub
commit 939e24b884
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,30 @@
# write a class that takes .env file and parses it into a dictionary
from dotenv import dotenv_values
DEFAULTS = {'SUBREDDIT': "AskReddit", 'ALLOW_NSFW': "False", 'POST_ID': "", 'THEME': "DARK", 'REDDIT_2FA': "no",
'TIMES_TO_RUN': "", 'MAX_COMMENT_LENGTH': "500", 'OPACITY': "1", 'VOICE': "en_us_001", 'STORYMODE': "False"}
class Config:
def __init__(self):
self.raw = dotenv_values("../.env")
self.load_attrs()
def __getattr__(self, attr): # code completion for attributes fix.
return getattr(self, attr)
def load_attrs(self):
for key, value in self.raw.items():
self.add_attr(key, value)
def add_attr(self, key, value):
if value is None or value == "":
setattr(self, key, DEFAULTS[key])
else:
setattr(self, key, str(value))
config = Config()
print(config.SUBREDDIT)

@ -88,20 +88,21 @@ def make_final_video(number_of_clips, length):
.resize(width=W - 100) .resize(width=W - 100)
.set_opacity(float(opacity)), .set_opacity(float(opacity)),
) )
if os.path.exists("assets/mp3/posttext.mp3"): #if os.path.exists("assets/mp3/posttext.mp3"):
image_clips.insert( # image_clips.insert(
0, # 0,
ImageClip("assets/png/title.png") # ImageClip("assets/png/title.png")
.set_duration(audio_clips[0].duration + audio_clips[1].duration) # .set_duration(audio_clips[0].duration + audio_clips[1].duration)
.set_position("center") # .set_position("center")
.resize(width=W - 100) # .resize(width=W - 100)
.set_opacity(float(opacity)), # .set_opacity(float(opacity)),
) # )
else: #else:
image_clips.insert( image_clips.insert(
0, 0,
ImageClip("assets/temp/png/title.png") ImageClip("assets/temp/png/title.png")
.set_duration(audio_clips[0].duration) .set_duration(audio_clips[0].duration)
#.set_duration(audixc vcco_clips[0].duration)
.set_position("center") .set_position("center")
.resize(width=W - 100) .resize(width=W - 100)
.set_opacity(float(opacity)), .set_opacity(float(opacity)),

Loading…
Cancel
Save