-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcheck_tg.py
28 lines (25 loc) · 841 Bytes
/
check_tg.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
import pathlib
import click
import tqdm
def check_tg(wavs, tg):
wavs = pathlib.Path(wavs)
tg = pathlib.Path(tg)
missing = []
filelist = list(wavs.glob('*.wav'))
for wavfile in tqdm.tqdm(filelist):
tgfile = tg / wavfile.with_suffix('.TextGrid').name
if not tgfile.exists():
missing.append(tgfile)
if len(missing) > 0:
print('These TextGrids are missing!')
for fn in missing:
print(f' - {fn}')
else:
print('All alignments have been successfully generated.')
@click.command('Check if all TextGrids are generated')
@click.option('--wavs', required=True, help='Path to the segments directory')
@click.option('--tg', required=True, help='Path to the TextGrids directory')
def main(wavs, tg):
check_tg(wavs, tg)
if __name__ == '__main__':
main()