@@ -67,6 +67,7 @@ def generate_practice_scores(source_dir: Path, output_dir: Path) -> int:
|
||||
return 0
|
||||
sources = sorted(source_dir.rglob('*.xml'))
|
||||
destinations: dict[Path, Path] = {}
|
||||
identities: dict[str, Path] = {}
|
||||
for path in sources:
|
||||
parts = path.relative_to(source_dir).parts
|
||||
if len(parts) != 3 or parts[0] not in ('chord', 'melody'):
|
||||
@@ -74,6 +75,10 @@ def generate_practice_scores(source_dir: Path, output_dir: Path) -> int:
|
||||
destination = Path(parts[0]) / parts[1] / slugify(path.stem)
|
||||
if destination in destinations:
|
||||
raise ValueError(f'{path}: practice output path collides with {destinations[destination]}: {destination}')
|
||||
identity = '-'.join(destination.parts)
|
||||
if identity in identities:
|
||||
raise ValueError(f'{path}: practice exercise ID collision with {identities[identity]}: {identity}')
|
||||
identities[identity] = path
|
||||
destinations[destination] = path
|
||||
count = 0
|
||||
for destination, path in destinations.items():
|
||||
|
||||
Reference in New Issue
Block a user