-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclient.py
executable file
·42 lines (32 loc) · 905 Bytes
/
client.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
#!/usr/bin/python
import os
import sys
import json
from string import join
import player
import system
from matcher import Matcher
def matchCommand(string, options):
# Handle keywords (play, pause, stop, jumpto)
keywordMap = {
'play': player.play,
'pause': player.pause,
'stop': player.stop,
'jumpto': player.jumpTo,
'reboot': system.reboot,
}
command = keywordMap.get(string)
# Catch keywords
if (command):
command(options=options)
else:
# Default to finding files through the Matcher class
m = Matcher(string, options)
m.matchVideo()
# Set up configuration from file
mydir = os.path.dirname(os.path.realpath(__file__))
optionsString = open(mydir + '/config.json')
options = json.load(optionsString)
# Parse command line arguments
argument = join(sys.argv[1::])
matchCommand(argument, options)