Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:elebumm/RedditVideoMakerBot into…
Browse files Browse the repository at this point in the history
… develop
  • Loading branch information
callumio committed Jul 1, 2022
2 parents cdcd9d3 + 7e2af9e commit 51f47dc
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 25 deletions.
2 changes: 1 addition & 1 deletion utils/console.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def handle_input(
if re.match(match, user_input) is not None:
if check_type is not False:
try:
user_input = check_type(user_input) # this line is fine
user_input = check_type(user_input) # this line is fine
if nmin is not None and user_input < nmin:
console.print("[red]" + oob_error) # Input too low failstate
continue
Expand Down
25 changes: 1 addition & 24 deletions video_creation/final_video.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
#!/usr/bin/env python3
import json
import multiprocessing
import os
import re
import time
from os.path import exists

from moviepy.editor import (
Expand All @@ -20,6 +18,7 @@

from utils.cleanup import cleanup
from utils.console import print_step, print_substep
from utils.videos import save_data

console = Console()

Expand Down Expand Up @@ -142,25 +141,3 @@ def make_final_video(number_of_clips: int, length: int, reddit_obj: dict[str]):
print_step(
f'Reddit title: {reddit_obj["thread_title"]} \n Background Credit: {os.getenv("background_credit")}'
)


def save_data(filename: str, reddit_title: str, reddit_id: str):
"""Saves the videos that have already been generated to a JSON file in video_creation/data/videos.json
Args:
filename (str): The finished video title name
"""
with open("./video_creation/data/videos.json", "r+", encoding="utf-8") as raw_vids:
done_vids = json.load(raw_vids)
if reddit_id in [video["id"] for video in done_vids]:
return # video already done but was specified to continue anyway in the .env file
payload = {
"id": reddit_id,
"time": str(int(time.time())),
"background_credit": str(os.getenv("background_credit")),
"reddit_title": reddit_title,
"filename": filename,
}
done_vids.append(payload)
raw_vids.seek(0)
json.dump(done_vids, raw_vids, ensure_ascii=False, indent=4)
1 change: 1 addition & 0 deletions video_creation/screenshot_downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from pathlib import Path

from playwright.async_api import async_playwright # pylint: disable=unused-import

# do not remove the above line

from playwright.sync_api import sync_playwright, ViewportSize
Expand Down

0 comments on commit 51f47dc

Please sign in to comment.