-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtestdriver.py
More file actions
executable file
·33 lines (24 loc) · 943 Bytes
/
testdriver.py
File metadata and controls
executable file
·33 lines (24 loc) · 943 Bytes
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
""" Below, take a bunch of WBM-files which appear alongside WAV-files of
matching names from a directory, and write out a single
table-of-contents file describing where each bookmark is found. """
execfile("wbm.py")
import navtools
import os
def list_qualified(qualifier,path):
return (n for n in os.listdir(path) if qualifier(n))
def ebn(path):
return os.path.splitext(os.path.basename(path))[0]
readdir = r"C:\tmp\k8"
os.chdir(readdir)
wbms = list_qualified(lambda a: ".wbm" in a, readdir)
bookmarkDict = {}
for wbm in wbms:
bookmarks = get_bookmarks(wbm, os.path.splitext(wbm)[0]+".wav")
bookmarkDict[ebn(wbm)+".wav"] = bookmarks
toc = []
gen = get_filename_generator(fileCount,dest="C:\\tmp",useExt=".wav",middlefix="")
for spans in bookmarkDict.values():
toc.extend(copy_pieces(spans,fnGen=gen))
handle = open("C:\\tmp\\k8_toc.txt",'w')
handle.write("\n\n".join(toc))
handle.close()