-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
executable file
·45 lines (36 loc) · 1.15 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
from distutils.log import INFO
from os import system
from classes.Absolubot import AbsoluBot
from classes.LogConfig import LogConfig
import sys
import getopt
def init(argv):
log = LogConfig()
log.logger.info("Initializing...")
arg_timeout = ""
arg_sleep = ""
arg_output = ""
arg_help = "{0} -t <timeout> -s <sleep> -o <output>".format(argv[0])
try:
opts, args = getopt.getopt(argv[1:], "ht:s:o:", ["help", "timeout=",
"sleep=", "output="])
except:
print(arg_help)
sys.exit(2)
for opt, arg in opts:
if opt in ("-h", "--help"):
print(arg_help) # print the help message
sys.exit(2)
elif opt in ("-t", "--timeout"):
arg_timeout = arg
elif opt in ("-s", "--sleep"):
arg_sleep = arg
elif opt in ("-o", "--output"):
arg_output = arg
log.logger.info("Parameters: timeout="+arg_timeout+" sleep="+arg_sleep+ " output="+arg_output)
bot = AbsoluBot(arg_timeout,arg_sleep,arg_output,log)
bot.downloadDrinksLinks()
bot.start()
sys.exit(0)
if __name__ == "__main__":
init(sys.argv)