|
|
|
|
|
|
|
|
import argparse |
|
|
from pathlib import Path |
|
|
|
|
|
import pandas as pd |
|
|
|
|
|
|
|
|
def get_args(): |
|
|
parser = argparse.ArgumentParser() |
|
|
parser.add_argument( |
|
|
"--audio_dir", |
|
|
default=r"D:\Users\tianx\HuggingSpaces\cc_audio_8\data\make_analysis_excel\download_wav\20251203\52", |
|
|
type=str |
|
|
) |
|
|
parser.add_argument( |
|
|
"--output_file", |
|
|
default=r"D:\Users\tianx\HuggingSpaces\cc_audio_8\data\make_analysis_excel\download_wav\20251203\52\readme.xlsx", |
|
|
type=str |
|
|
) |
|
|
args = parser.parse_args() |
|
|
return args |
|
|
|
|
|
|
|
|
def main(): |
|
|
args = get_args() |
|
|
audio_dir = Path(args.audio_dir) |
|
|
output_file = Path(args.output_file) |
|
|
output_file.parent.mkdir(parents=True, exist_ok=True) |
|
|
|
|
|
result = list() |
|
|
for filename in audio_dir.glob("**/early_media_*.wav"): |
|
|
suffix = filename.parts[-2] |
|
|
splits = filename.stem.split("_") |
|
|
call_id = splits[2] |
|
|
|
|
|
result.append({ |
|
|
"suffix": suffix, |
|
|
"call_id": call_id, |
|
|
}) |
|
|
|
|
|
result = pd.DataFrame(result) |
|
|
result.to_excel( |
|
|
output_file.as_posix(), |
|
|
index=False |
|
|
) |
|
|
|
|
|
return |
|
|
|
|
|
|
|
|
if __name__ == "__main__": |
|
|
main() |
|
|
|