From 532e49276a7331e0db78636109e62f349ec01d98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Muhammed=20Mustafa=20Ak=C5=9Fam?= Date: Thu, 7 Jul 2022 14:36:23 +0300 Subject: [PATCH] Adding subreddit to videos.json Adding subreddit data to videos.json --- utils/videos.py | 4 +++- video_creation/final_video.py | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/utils/videos.py b/utils/videos.py index d050ab8..4a91e8c 100755 --- a/utils/videos.py +++ b/utils/videos.py @@ -34,11 +34,12 @@ def check_done( return redditobj -def save_data(filename: str, reddit_title: str, reddit_id: str, credit: str): +def save_data(subreddit: str, filename: str, reddit_title: str, reddit_id: str, credit: 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 + @param subreddit: @param filename: @param reddit_id: @param reddit_title: @@ -48,6 +49,7 @@ def save_data(filename: str, reddit_title: str, reddit_id: str, credit: str): if reddit_id in [video["id"] for video in done_vids]: return # video already done but was specified to continue anyway in the config file payload = { + "subreddit": subreddit, "id": reddit_id, "time": str(int(time.time())), "background_credit": credit, diff --git a/video_creation/final_video.py b/video_creation/final_video.py index d08e4cb..1dad789 100755 --- a/video_creation/final_video.py +++ b/video_creation/final_video.py @@ -115,7 +115,7 @@ def make_final_video( filename = f"{name_normalize(title)}.mp4" subreddit = settings.config["reddit"]["thread"]["subreddit"] - save_data(filename, title, idx, background_config[2]) + save_data(subreddit, filename, title, idx, background_config[2]) if not exists(f"./results/{subreddit}"): print_substep("The results folder didn't exist so I made it")