forked from edde746/tiktok-askreddit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
31 lines (29 loc) · 858 Bytes
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from datetime import datetime
import random
import sys
from scrape import scrape_post
from upload import upload
from utils import config, clean_temp, log, first_run
from image import generate_images
from tts import generate_audio
from video import render_video
def do_order(subreddit, post_type, time = 0):
post = scrape_post(subreddit, post_type)
generate_images(post)
generate_audio(post)
render_video(post)
upload(post, time)
log(post)
clean_temp()
if __name__ == '__main__':
random.seed(datetime.now())
first_run()
try:
if len(sys.argv) == 1:
do_order(*random.choice(config["default_pool"]))
else:
do_order(sys.argv[1], sys.argv[2])
except (KeyboardInterrupt, Exception) as e:
print(e)
clean_temp()
exit(1)