@@ -13,7 +13,7 @@ from generator.summary import validate_expected_performance_summary, validate_pr
|
||||
from generator.parts import source_paths
|
||||
from generator.engraving import engrave_tree
|
||||
from generator.playback import compile_tree
|
||||
from generator.catalogue import build_catalogue
|
||||
from generator.catalog import build_catalog
|
||||
|
||||
RUNTIME_FONT_FILES = ("PetalumaScript.otf", "OFL.txt")
|
||||
|
||||
@@ -74,8 +74,8 @@ def generate_assets(args: argparse.Namespace) -> None:
|
||||
engrave_tree(staged, static_assets_dir / 'fonts' / 'petaluma', cache_dir=cache_dir, jobs=getattr(args, 'jobs', 1), progress=progress)
|
||||
report('validating score, page, and audio assets')
|
||||
validate_generated_tree(staged)
|
||||
report('building catalogue database')
|
||||
build_catalogue(staged)
|
||||
report('building catalog database')
|
||||
build_catalog(staged)
|
||||
backup = Path(temporary) / 'previous'
|
||||
if output_dir.exists():
|
||||
output_dir.rename(backup)
|
||||
|
||||
@@ -81,15 +81,15 @@ def populate(connection: sqlite3.Connection, root: Path) -> None:
|
||||
raise ValueError(f'practice exercise requires all three parts: {identity}')
|
||||
connection.commit()
|
||||
if connection.execute('PRAGMA integrity_check').fetchall() != [('ok',)]:
|
||||
raise ValueError('catalogue integrity check failed')
|
||||
raise ValueError('catalog integrity check failed')
|
||||
|
||||
def build_catalogue(root: Path, destination: Path | None = None) -> Path:
|
||||
def build_catalog(root: Path, destination: Path | None = None) -> Path:
|
||||
if not root.is_dir():
|
||||
raise ValueError(f'{root}: score asset directory not found')
|
||||
destination = destination or root / 'catalogue.db'
|
||||
destination = destination or root / 'catalog.db'
|
||||
destination.parent.mkdir(parents=True, exist_ok=True)
|
||||
with tempfile.TemporaryDirectory(prefix='.vamp-catalogue-', dir=destination.parent) as temporary:
|
||||
staged = Path(temporary) / 'catalogue.db'
|
||||
with tempfile.TemporaryDirectory(prefix='.vamp-catalog-', dir=destination.parent) as temporary:
|
||||
staged = Path(temporary) / 'catalog.db'
|
||||
connection = sqlite3.connect(staged)
|
||||
try:
|
||||
populate(connection, root)
|
||||
@@ -99,8 +99,8 @@ def build_catalogue(root: Path, destination: Path | None = None) -> Path:
|
||||
return destination
|
||||
|
||||
if __name__ == '__main__':
|
||||
parser = argparse.ArgumentParser(description='Compile generated score bundles into a read-only runtime catalogue.')
|
||||
parser = argparse.ArgumentParser(description='Compile generated score bundles into a read-only runtime catalog.')
|
||||
parser.add_argument('assets', type=Path)
|
||||
parser.add_argument('destination', type=Path, nargs='?')
|
||||
arguments = parser.parse_args()
|
||||
build_catalogue(arguments.assets, arguments.destination)
|
||||
build_catalog(arguments.assets, arguments.destination)
|
||||
+3
-3
@@ -41,10 +41,10 @@ def shift_key(key: dict, steps: int, semitones: int) -> dict:
|
||||
result['custom'] = True
|
||||
if 'cancel' in key:
|
||||
# A cancellation references the old signature, not a count of naturals.
|
||||
cancelled = shift_key(key_from_fifths(key['cancel']), steps, semitones)
|
||||
if cancelled.get('custom'):
|
||||
canceled = shift_key(key_from_fifths(key['cancel']), steps, semitones)
|
||||
if canceled.get('custom'):
|
||||
raise ValueError('transposed key cancellation cannot be represented by fifths')
|
||||
result['cancel'] = cancelled['fifths']
|
||||
result['cancel'] = canceled['fifths']
|
||||
return result
|
||||
|
||||
def concert_document(document: dict, *, octave_transposing: bool = False) -> dict:
|
||||
|
||||
Reference in New Issue
Block a user