forked from notner/Medusa
-
Notifications
You must be signed in to change notification settings - Fork 0
/
snake.py
executable file
·64 lines (43 loc) · 1.58 KB
/
snake.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
#!/usr/bin/env python
"""
A Snake is a media player. It receives instructions from Medusa's Head.
"""
import argparse
import sys
from PyQt4 import QtGui
from lib.medusa.communicate import Communicate
from lib.medusa.log import log
from lib.snake.control import Control
from lib.snake.interface import Interface
from lib.snake.proxy import Proxy
#------------------------------------------------------------------------------
def main(options):
application = QtGui.QApplication(sys.argv)
control = Control()
control.name = options.name
control.media_path = options.media
control.downloads_path = options.downloads
Proxy.control = control
communicate = Communicate(proxy=Proxy, name=options.name, qthread=True)
control.communicate = communicate
interface = Interface(control)
interface.initialise()
control._send_update()
application.exec_()
#------------------------------------------------------------------------------
def parse_arguments():
parser = argparse.ArgumentParser()
parser.add_argument("-n", "--name",
action="store", required=True)
parser.add_argument("-m", "--media",
action="store", type=unicode, required=True)
parser.add_argument("-d", "--downloads",
action="store", type=unicode)
return parser.parse_args()
#------------------------------------------------------------------------------
if __name__ == "__main__":
try:
log.warn("Snake initialised")
main(parse_arguments())
finally:
log.warn("Snake exited")