-
Notifications
You must be signed in to change notification settings - Fork 7
/
process.py
85 lines (65 loc) · 2.29 KB
/
process.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
import requests
import random
import formatResponse
import editImage
import videoMaker
import os
import glob
import notifBot
import YTupload
# Getting memes from API and formatting it into a list
url = "https://meme-api.herokuapp.com/gimme/"
count = 10
# og_subreddits = ["memes","dankmemes","cursedcomments","me_irl","HistoryMemes","BlackPeopleTwitter","ihadastroke","technicallythetruth","trippinthroughtime","starterpacks","2meirl4meirl","deepfriedmeme","Meanjokes","suicidebywords","madlads"] Not accessible until protest is over
subreddits = ["memes","dankmemes","cursedcomments","me_irl","HistoryMemes","BlackPeopleTwitter","ihadastroke","technicallythetruth","trippinthroughtime","starterpacks","2meirl4meirl","suicidebywords","madlads"]
notifBot.send("Task initiated!")
def make(j):
try:
# Getting response from API
memeList = []
rand = random.randrange(0,len(subreddits))
resp = requests.get(url+subreddits[rand]+"/"+str(count)).json()
print("Subreddit: ",subreddits[rand])
memeList = formatResponse.makeMemeList(resp)
except:
resp.status_code == 200
finally:
# Calling formatResponse
print("Raw Data:\n")
print(memeList)
print("\n")
#Clearing all the old photos in the process folder
files = glob.glob('processed/*')
for f in files:
os.remove(f)
#Reformat Image using editImage
try:
editImage.Reformat_Image(memeList)
finally:
print("Done!")
#Making a video out of the Images
try:
videoMaker.makeVidFromImgSequence(memeList,j)
finally:
print("Video is done!")
for j in range(0,12):
print("\n Video #",j)
try:
make(j)
except:
continue
#Export Video
try:
print("Combining all the clips")
videoMaker.combineVideos()
print("Video Completed!")
notifBot.send("Video Completed, Uploading to Youtube!")
upvid = YTupload.upload()
print("Video uploaded")
print(upvid[0] , upvid[1])
notifBot.sendImg(upvid[2])
notifBot.send("Video Uploaded, URL: https://www.youtube.com/watch?v="+upvid[0]+" and vid info:"+upvid[1])
notifBot.send("Video Uploaded, URL: https://www.youtube.com/watch?v="+upvid[0])
notifBot.send("Done!")
except:
notifBot.send("Some error occured while exporting and uploading the video!")