Revamp
This commit is contained in:
@@ -12,13 +12,20 @@ def main():
|
||||
parser.add_argument('--data-dir',type=Path,default=Path('data'))
|
||||
parser.add_argument('--output',type=Path,required=True)
|
||||
parser.add_argument('--cache-dir',type=Path)
|
||||
parser.add_argument('--solo-xml',type=Path,help='Also export a completed solo role as MusicXML.')
|
||||
parser.add_argument('--settings',type=Path)
|
||||
args=parser.parse_args()
|
||||
if args.solo_xml and not args.role.endswith('_solo'):
|
||||
parser.error('--solo-xml requires a solo role')
|
||||
source=production.SourceAnalysis.read(parts.prepare_document(musicxml.load_musicxml(args.song)))
|
||||
start=time.monotonic()
|
||||
result=production.generate_role(source,args.role,args.data_dir,json.loads(args.settings.read_text()) if args.settings else {},args.cache_dir)
|
||||
args.output.parent.mkdir(parents=True,exist_ok=True)
|
||||
args.output.write_text(json.dumps(result,indent=2))
|
||||
if args.solo_xml:
|
||||
from generator.solo.export import write_role
|
||||
manifest=write_role(result,args.solo_xml)
|
||||
args.solo_xml.with_suffix('.manifest.solo').write_text(json.dumps(manifest,indent=2)+'\n')
|
||||
print(f'{args.role}: {time.monotonic()-start:.2f}s wall; cached={result["cache_hit"]}; original composition {result["seconds"]:.2f}s')
|
||||
|
||||
if __name__=='__main__':main()
|
||||
|
||||
Reference in New Issue
Block a user