forked from AliNL/Sleep-Early
-
Notifications
You must be signed in to change notification settings - Fork 0
/
group.py
executable file
·44 lines (36 loc) · 1.07 KB
/
group.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
#!/usr/local/bin/ python
from function import *
import sys
import getopt
def main(argv):
is_lead = ''
device = ''
try:
opts, args = getopt.getopt(argv, "hl:d:", ["is_lead=", "device="])
except getopt.GetoptError:
print 'Please input: python group.py -d <device>(android or ios) -l <is_lead>(y or n)'
sys.exit(2)
for opt, arg in opts:
if opt == "-h":
print 'Please input: python group.py -d <device>(android or ios) -l <is_lead>(y or n)'
sys.exit()
elif opt in ("-l", "--is_lead"):
is_lead = arg
elif opt in ("-d", "--device"):
device = arg
task = Group(device)
while True:
if is_lead == 'y':
if not task.start_group_fight():
break
task.group_fight()
task.ok()
else:
if not task.wait_in_group():
break
task.group_fight()
if not task.get_invitation():
break
task.analysis()
if __name__ == "__main__":
main(sys.argv[1:])