-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.py
61 lines (45 loc) · 1.44 KB
/
main.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
import logging
import json
import argparse
from serializers import JSONSerializer
def default_annotator(mix_path, src_track_paths):
from nodes import Unmixer, GenericProvider, SegmentFinder, XFadeFinder, Fingerprinter
from annotator import Annotator
return Annotator([
GenericProvider(
src_track_paths=src_track_paths,
mix_path=mix_path
),
Fingerprinter(lazy=False),
Unmixer(),
XFadeFinder(),
SegmentFinder()
])
def main():
logging.basicConfig(level=logging.INFO)
parser = argparse.ArgumentParser(description='Analyse a DJ mix and reverse engineer it')
parser.add_argument(
'mix_path',
metavar='<mix_path>',
action='store',
nargs=1,
help='Path to a mix which needs to be analysed')
parser.add_argument(
'source_tracks',
metavar='<source_track_directory_path>',
action='store',
nargs=1,
help='Path to all source tracks')
parser.add_argument(
'output_file',
metavar='<output_file>',
action='store',
nargs=1,
help='Path to the output JSON file')
args = parser.parse_args()
result = default_annotator(args.mix_path[0], args.source_tracks[0]).start()
serializer = JSONSerializer()
with open(args.output_file[0], "w") as f:
f.write(json.dumps(serializer.output(result)))
if __name__ == '__main__':
main()