forked from RebelTechnology/OpenWareLab
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupload.py
More file actions
executable file
·35 lines (27 loc) · 1.03 KB
/
upload.py
File metadata and controls
executable file
·35 lines (27 loc) · 1.03 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
#!/usr/bin/env python3
import argparse
import os
import shutil
import subprocess
parser = argparse.ArgumentParser('Upload Faust samples')
parser.add_argument('--owl', help='path to OwlProgram directory', default='../../OwlProgram/')
parser.add_argument('--slot', help='slot number used for first patch', default=1, type=int)
args = parser.parse_args()
faust_files = [fname for fname in os.listdir() if fname.endswith('.dsp')]
faust_files.sort()
cwd = os.path.abspath('.')
owl = os.path.abspath(args.owl)
env = os.environ.copy()
print(f'Using owl program from {owl}')
for i, fname in enumerate(faust_files):
# copy file without first 2 symbols used for sorting
dst = os.path.join(owl, 'PatchSource', fname[2:])
shutil.copy(fname, dst)
# set env vars for current patch processing
env['SLOT'] = str(args.slot + i)
env['FAUST'] = fname[2:-4]
print()
print(f'{env["SLOT"]} <= {env["FAUST"]}')
# upload patch
subprocess.run(['make', 'clean', 'store'], cwd=os.path.abspath(args.owl), env=env)
os.remove(dst)