-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathagConcatenate.py
executable file
·48 lines (38 loc) · 1.39 KB
/
agConcatenate.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
#!/usr/bin/env python3
############################################################################
## This software is distributed for free, without warranties of any kind. ##
## Send bug reports or suggestions to hackbarth@gmail.com ##
############################################################################
import sys, os, audioguide
from optparse import OptionParser
parser = OptionParser(usage="python3 %prog [-i] optionsfile")
parser.set_defaults(INTERACTIVE=False)
parser.add_option("-i", "--interactive", action="store_true", dest="INTERACTIVE", help="This flag turns on intercative mode.")
(options, args) = parser.parse_args()
if len(args) == 0:
print('\nPlease specify an options file as the first argument\n')
sys.exit(1)
opspath = os.path.realpath(args[0])
if not os.path.exists(opspath):
print('\nCouldn\'t find an options called "%s"\n'%sys.argv[1])
sys.exit(1)
ag = audioguide.main()
ops_mtime = ag.parse_options_file(opspath, init=True)
ag.execute()
if options.INTERACTIVE:
import time
print("Ready..")
try:
while True:
time.sleep(0.1)
if not os.path.exists(opspath):
print("\nYour options file disappeared!\n")
sys.exit(0)
mtime_cur = os.path.getmtime(opspath)
if mtime_cur != ops_mtime:
ops_mtime = ag.parse_options_file(opspath)
ag.execute()
print("Done. Ready..")
ops_mtime = mtime_cur
except KeyboardInterrupt:
sys.exit(0)