-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
52 lines (35 loc) · 1.35 KB
/
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
from image import saveSubmission, saveComment
from reddit import hotQuestions, moreComments
from ffmpeg import createVideo
from tts import get_token, save_audio
def getUserInput(questions):
print("Type the number corresponding to the Reddit thread(1-8)")
userInput = input()
if userInput.isdigit() == False or int(userInput) > 8 or int(userInput) < 1:
print("Not a valid number")
getUserInput(questions)
else:
start(questions[int(userInput)-1])
def start(submission):
submission.comment_sort = "best"
submission.comment_limit = 70
saveSubmission(submission.title)
access_token = get_token()
save_audio(submission.title, "frame1", access_token)
num = 2
for top_level_comment in submission.comments:
if isinstance(top_level_comment, moreComments()):
continue
if len(top_level_comment.body) <= 900:
saveComment(top_level_comment.author.name, top_level_comment.body, 42, num)
save_audio(top_level_comment.body, "frame" + str(num), access_token)
print("Frame " + str(num) + " completed")
num += 1
createVideo(num-1, submission.title)
print("Searching...")
questions = hotQuestions()
qList = []
for num, sub in enumerate(questions, start=1):
qList.append(sub)
print(str(num) + " - " + sub.title)
getUserInput(qList)