-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathalexPhoto.py
More file actions
46 lines (39 loc) · 1.11 KB
/
alexPhoto.py
File metadata and controls
46 lines (39 loc) · 1.11 KB
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
#!/usr/bin/env python
import os
import random
import subprocess
'''custom approve
upload specific phots for know users
default photo for unknow
give option to uplaod your own image'''
ImgPath = "AlexPhotos"
def Alex():
EnsureDirExists(ImgPath)
if os.listdir(ImgPath) == []:
return 'No Photos Exist'
else:
choice = random.choice(os.listdir(ImgPath))
print choice
return ImgPath + "/" + choice
#check if userID has a picuture
#is so send that picture back
#else send default pictte
#return p
def EnsureDirExists(path):
if not os.path.exists(path):
os.mkdir(path)
def EnsureFileExists(filename):
if not os.path.exists(filename):
return False
return True
def AddPhoto(tempPhoto):
return "not implemented"
def deleteDisapprovalPhoto(userID):
if os.path.exists('images/disapproval_' + str(userID) + '.jpg'):
os.remove('images/disapproval_' + str(userID) + '.jpg')
return "your photo has been removed with extreme prejudice"
return "you don't have any disapproval photos added, you can add one with /disapprovalphoto"
def main():
print Alex()
if __name__ == '__main__':
main()