-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhorn.py
More file actions
executable file
·59 lines (48 loc) · 1.24 KB
/
horn.py
File metadata and controls
executable file
·59 lines (48 loc) · 1.24 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
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/usr/bin/python
# Author: shade (Copyright C 2013)
#
# License: http://www.wtfpl.net/txt/copying/
import sys, getopt
from mh import MH
from mhplayer import MHPlayer
def usage():
print ""
print "USAGE: horn.py [params]"
print "EXAMPLE: ./horn.py"
print ""
print "PARAMETERS: -m, -u, -h"
print ""
print " -h, --help => Help - prints this text."
print " -m, --mode => Mode - can be tourney, normal (default), or keepalive."
print " -u, --username => Username for off-site play. If passed, a password will be required when run."
print ""
print "EXAMPLES:"
print " ./horn.py -m keepalive"
print " ./horn.py -m tourney -u dragan"
print " ./horn.py -u dragan -m keepalive"
print " ./horn.py -u dragan --mode tourney"
print ""
exit(1)
def main(argv):
try:
opts, args = getopt.getopt(argv, "hu:m:", ["help", "username=", "mode="])
except getopt.GetoptError:
usage()
sys.exit(2)
mode = None
username = None
password = None
for opt, arg in opts:
if opt in ("-h", "--help"):
usage()
exit(1)
elif opt in ("-m", "--mode"):
mode = arg
elif opt in ("-u", "--username"):
username = arg
if mode is None:
mode = "default"
player = MHPlayer(mode, username)
player.play()
if __name__ == "__main__":
main(sys.argv[1:])