mirror of https://github.com/coqui-ai/TTS.git
simplified folder variable
parent
78c3897599
commit
4c9fbeeaf8
|
@ -75,21 +75,19 @@ def mailabs(root_path, meta_files=None):
|
||||||
speaker_regex = re.compile("by_book/(male|female)/(?P<speaker_name>[^/]+)/")
|
speaker_regex = re.compile("by_book/(male|female)/(?P<speaker_name>[^/]+)/")
|
||||||
if meta_files is None:
|
if meta_files is None:
|
||||||
csv_files = glob(root_path+"/**/metadata.csv", recursive=True)
|
csv_files = glob(root_path+"/**/metadata.csv", recursive=True)
|
||||||
folders = [os.path.dirname(f) for f in csv_files]
|
|
||||||
else:
|
else:
|
||||||
csv_files = meta_files
|
csv_files = meta_files
|
||||||
folders = [f.strip().split("by_book")[1][1:] for f in csv_files]
|
|
||||||
# meta_files = [f.strip() for f in meta_files.split(",")]
|
# meta_files = [f.strip() for f in meta_files.split(",")]
|
||||||
items = []
|
items = []
|
||||||
for idx, csv_file in enumerate(csv_files):
|
for idx, csv_file in enumerate(csv_files):
|
||||||
txt_file = os.path.join(root_path, csv_file)
|
txt_file = os.path.join(root_path, csv_file)
|
||||||
|
folder = os.path.dirname(txt_file)
|
||||||
# determine speaker based on folder structure...
|
# determine speaker based on folder structure...
|
||||||
speaker_name_match = speaker_regex.search(txt_file)
|
speaker_name_match = speaker_regex.search(txt_file)
|
||||||
if speaker_name_match is None:
|
if speaker_name_match is None:
|
||||||
continue
|
continue
|
||||||
speaker_name = speaker_name_match.group("speaker_name")
|
speaker_name = speaker_name_match.group("speaker_name")
|
||||||
print(" | > {}".format(csv_file))
|
print(" | > {}".format(csv_file))
|
||||||
folder = folders[idx]
|
|
||||||
with open(txt_file, 'r') as ttf:
|
with open(txt_file, 'r') as ttf:
|
||||||
for line in ttf:
|
for line in ttf:
|
||||||
cols = line.split('|')
|
cols = line.split('|')
|
||||||
|
|
Loading…
Reference in New Issue