-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.py
More file actions
executable file
·56 lines (39 loc) · 1.55 KB
/
run.py
File metadata and controls
executable file
·56 lines (39 loc) · 1.55 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
#!/usr/bin/env python
import json
from analyzer.audio import Analyze
from argparse import ArgumentParser
if __name__ == '__main__':
config = {}
try:
confile = open("config.json")
config = json.loads(confile.read())
except Exception, e:
print e
parser = ArgumentParser(description = """
Analyzes all audio files found (recursively) in a folder using MusicExtractor.
""")
parser.add_argument('-d', '--dir', help='input directory', required=True)
parser.add_argument('-db', '--db', help='mongo db uri', required=False)
parser.add_argument('-nvk_token', '--nvk_token', help='navaak app token',
required=False)
parser.add_argument('-pio_token', '--pio_token', help='pio token',
required=False)
parser.add_argument('-mode', '--mode',
help='analyzer scan mode [scan, watch, push_pio]',
required=False)
parser.add_argument(
'-t', '--type', nargs='+',
help='type of audio files to include (can use wildcards)',
required=False)
args = parser.parse_args()
if not args.db and "db" in config:
args.db = config["db"]
if not args.nvk_token and "nvk_token" in config:
args.nvk_token = config["nvk_token"]
if not args.pio_token and "pio_token" in config:
args.pio_token = config["pio_token"]
analyzer = Analyze(args.db, args.dir, args.nvk_token, args.pio_token)
if args.mode == 'scan':
analyzer.scan(args.type)
else:
analyzer.watch()