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
|
# channel plugins
channel_modules = ["shoutcast", "xiph", "internet_radio", "jamendo", "myoggradio", "live365"]
current_channel = "cli"
plugins = {} # only populated sparsely by .stream()
# start
def __init__(self):
# fake init
action.action.main = empty_parent()
action.action.main.current_channel = self.current_channel
# check if enough arguments, else help
if len(sys.argv)<3:
a = self.help
# first cmdline arg == action
else:
command = sys.argv[1]
a = self.__getattribute__(command)
# run
result = a(*sys.argv[2:])
if result:
self.json(result)
# show help
def help(self, *args):
print("""
|
|
|
|
>
|
>
>
>
|
|
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
|
# channel plugins
channel_modules = ["shoutcast", "xiph", "internet_radio", "jamendo", "myoggradio", "live365"]
current_channel = "cli"
plugins = {} # only populated sparsely by .stream()
# start
def __init__(self, actions):
# fake init
action.action.main = empty_parent()
action.action.main.current_channel = self.current_channel
# check if enough arguments, else help
if not actions:
a = self.help
# first cmdline arg == action
else:
command = actions[0]
if command in self.__dict__:
cmd = self.__getattribute__(command)
else:
print "No such command:", command
return
# run
result = cmd(*actions[1:])
if result:
self.json(result)
# show help
def help(self, *args):
print("""
|