feat: ads a check to see if the video has already been done as suggested in #12
closes #12pull/418/head
parent
80653eab7c
commit
8b5670a8eb
@ -0,0 +1,22 @@
|
||||
import inspect
|
||||
import json
|
||||
from os import getenv
|
||||
|
||||
from utils.console import print_step
|
||||
|
||||
|
||||
def check_done(redditobj): # don't set this to be run anyplace that isn't subreddit.py bc of inspect stack
|
||||
"""params:
|
||||
reddit_object: The Reddit Object you received in askreddit.py"""
|
||||
if getenv('POST_ID'):
|
||||
print_step(
|
||||
'You already have done this video but since it was declared specifically in the .env file the program will continue')
|
||||
return redditobj
|
||||
with open('./video_creation/data/videos.json', 'r') as done_vids_raw:
|
||||
done_videos = json.load(done_vids_raw)
|
||||
for video in done_videos:
|
||||
if video['id'] == str(redditobj):
|
||||
print_step('Getting new post as the current one has already been done')
|
||||
from reddit.subreddit import get_subreddit_threads
|
||||
return get_subreddit_threads() # recursive func
|
||||
return redditobj
|
@ -0,0 +1,23 @@
|
||||
[
|
||||
{
|
||||
"id": "ult7el",
|
||||
"time": "1654117088",
|
||||
"background_credit": "Orbital Gameplay",
|
||||
"reddit_title": "What famous place is not worth visiting?",
|
||||
"filename": "What famous place is not worth....mp4"
|
||||
},
|
||||
{
|
||||
"id": "v2hup1",
|
||||
"time": "1654118137",
|
||||
"background_credit": "bbswitzer",
|
||||
"reddit_title": "What job interview question do you think is pointless?",
|
||||
"filename": "What job interview question do....mp4"
|
||||
},
|
||||
{
|
||||
"id": "v2nqiu",
|
||||
"time": "1654118543",
|
||||
"background_credit": "bbswitzer",
|
||||
"reddit_title": "What is a fact that people are not ready to hear?",
|
||||
"filename": "What is a fact that people are....mp4"
|
||||
}
|
||||
]
|
Loading…
Reference in new issue