-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmidiPyBatcher.py
More file actions
40 lines (32 loc) · 1.42 KB
/
midiPyBatcher.py
File metadata and controls
40 lines (32 loc) · 1.42 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
# v1.1.0
# Coded by Jabril
# http://sefdstuff.com/jabrils
import os
import argparse
import mcf as backend
# standard argparse stuff
parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter, add_help=False)
parser.add_argument('-h', '--help', action='help', default=argparse.SUPPRESS,
help='** = required')
parser.add_argument('-sl', "--save_log", action='store_true',
help='add the -sl flag to save a log of the process')
parser.add_argument('-bt', "--batch_text", action='store_true',
help='add the -bt flag to batch all text files in Batch Texts converting them to .mid')
parser.add_argument('-bm', "--batch_midi", action='store_true',
help='add the -bm flag to batch all midi files in Batch Midis converting them to .txt')
parser.add_argument('-e', '--ext', type=str, default='csv',
help='add the -e flag to specify what extension you want to read or write the midi file to')
args = parser.parse_args()
thisDir = os.getcwd()
allFoldersNeeded = ['Batch Midis','Batch CSV', 'Converted to Midis', 'Converted to CSV']
#
for i in range(len(allFoldersNeeded)):
if not os.path.exists(allFoldersNeeded[i]):
os.makedirs(allFoldersNeeded[i])
#
if args.batch_text:
backend.Batch(args,thisDir,allFoldersNeeded[1],allFoldersNeeded[2], "csvmidi")
#
if args.batch_midi:
backend.Batch(args,thisDir,allFoldersNeeded[0],allFoldersNeeded[3], "midicsv")
print("...& DONE!")