-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathspeedyplus.pi.py
123 lines (92 loc) · 2.75 KB
/
speedyplus.pi.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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#
# Jumoo.PageSpeedyPlus -
#
# A Website Speedtest, appInterigating, [AccessibilityChecking] Machine
#
# Version : 2.0.0.
# Date : 30th July 2014
# Live : http://jumoo.uk/pagespeedy
#
import sys, getopt
from speedy.speedydb import SpeedyDb
from speedy.pagespeedy import PageSpeedy
import datetime
# from speedy.speedywapple import SpeedyWapple
# from speedy.speedyachecker import AChecker
# from speedy.peeky import Peeky
# from speedy.screengrabby import ScreenGrabby as grabby
def getMonth():
d = datetime.date.today()
t = datetime.timedelta(days=5)
d = d + t
monthId = "{0:02d}{1}".format(d.month, d.year)
speedy = SpeedyDb()
id = speedy.getMonthByDate(d)
speedy.cleanClose()
return id
def main(argv):
monthid = 0
single = 0;
try:
opts, args = getopt.getopt(argv, "lhmn:s:", ['month','list', 'single', 'now'])
except getopt.GetoptError:
print 'SpeedyPlus.py -m <monthId> [-s <siteid>]'
sys.exit(2)
for opt, arg in opts:
if opt == '-h':
print 'SpeedyPlus.py -m <monthId>'
sys.exit()
elif opt in ('-m', '--month'):
monthid = arg
elif opt in ('-l', '--list'):
s = SpeedyDb()
s.listMonths()
sys.exit()
elif opt in ('-s', '--single'):
single = arg
elif opt in ('-n', '--now'):
monthid = getMonth()
print 'MonthId [', monthid , ']'
if monthid != 0:
s = SpeedyDb()
if single != 0:
#process just one site. (ignore valid month thing)
ps = PageSpeedy()
ps.ProcessSingleSite(single, monthid)
#wp = wapple.SpeedyWapple()
#wp.ProcessSingleSite(single, monthid)
#ch = checker.AChecker()
#ch.ProcessSingleSite(single, monthid)
sys.exit()
elif s.validMonth(monthid) == 1 :
s.backup(monthid)
# pagespeed check
ps = PageSpeedy()
ps.runSpeedy(monthid)
# wapplizer check
# wp = SpeedyWapple()
# wp.process(monthid)
# peeky (extra looking)
# pky = Peeky()
# pky.goPeek(monthid)
# pky.close();
# screengrabs
# grab = ScreenGrabby()
# grab.runGrabby(monthid)
# accessilbity check
# ch = checker.AChecker()
# ch.runChecker(monthid)
s.closeMonth(monthid)
else:
print 'not a valid month'
if __name__ == '__main__':
print r'-------------------------------------------------------------'
print r' ____ _____ __ '
print r' / __ \____ _____ ____ / ___/____ ___ ___ ____/ /_ __ '
print r' / /_/ / __ `/ __ `/ _ \\__ \/ __ \/ _ \/ _ \/ __ / / / / '
print r' / ____/ /_/ / /_/ / __/__/ / /_/ / __/ __/ /_/ / /_/ / '
print r'/_/ \__,_/\__, /\___/____/ .___/\___/\___/\__,_/\__, / '
print r' /____/ /_/ and other tools /____/ '
print r'-------------------------------------------------------------'
print r''
main(sys.argv[1:])