# Builds the page as separate files (no inline code): index.html, sounds.css, sounds.js. # usage: python3 make.py [--site] import re, sys, os, shutil out=sys.argv[1]; site='--site' in sys.argv s=open('index.src.txt').read() css=re.search(r'',s,re.S).group(1) js=re.search(r'',s,re.S).group(1).replace('__CLIPS__',open('manifest.json').read().strip()) html=s.replace(re.search(r'',s,re.S).group(0),'\n') html=html.replace(re.search(r'',html,re.S).group(0),'') meta=''' ''' if site: meta+='\n\n' html=html.replace('\n
','\n

More free tools by Shahrouz Ghadimi

\n
',1) assert 'class="more"' in html html=html.replace('',meta+'<title>',1) os.makedirs(out,exist_ok=True) open(os.path.join(out,'index.html'),'w').write(html) open(os.path.join(out,'sounds.css'),'w').write(css.strip()+'\n.more{margin:6px 0 14px}.more a{color:#1b6fa8;font-weight:600}\n') open(os.path.join(out,'sounds.js'),'w').write(js.strip()+'\n') for d in ('audio','fonts'): if os.path.exists(os.path.join(out,d)): shutil.rmtree(os.path.join(out,d)) shutil.copytree(d,os.path.join(out,d)) print('built',out,'site' if site else 'preview', len(os.listdir(os.path.join(out,'audio'))),'clips')