stt_data_generator / src /utils /load_existing_audio_ids.py
Abdelrahman2922's picture
Upload 95 files
8ab5485 verified
Raw
History Blame Contribute Delete
487 Bytes
import json
from pathlib import Path
def load_existing_audio_ids(metadata_path: Path) -> set[str]:
existing_ids = set()
if not metadata_path.exists():
return existing_ids
with open(metadata_path, "r", encoding="utf-8") as f:
for line in f:
try:
record = json.loads(line)
existing_ids.add(record["audio_id"])
except Exception:
continue
return existing_ids