32 lines
2.1 KiB
Plaintext
32 lines
2.1 KiB
Plaintext
from pathlib import Path
|
|
import json,shutil,datetime,hashlib
|
|
R=Path.cwd();D=R/'docs/hel-892/wanrole-document-evidence';F=D.parent/'wanrole-reference'
|
|
D.mkdir(exist_ok=True);F.mkdir(exist_ok=True)
|
|
old=D.parent/'wanplus-document-evidence';oldf=D.parent/'wanplus-reference'
|
|
base='f80346473a275758d1b7bcfdc4924de9193eff8c'
|
|
repl={'wanplus':'wanrole','WanAnimatePlus动作迁移':'WanAnimatePlus角色迁移','Wan2.1_Scail-2_动作迁移':'Wan2.1_Scail-2_角色迁移','8cceb56c006b00a9dd9cf3dda2233a3ea740754d':base}
|
|
for p in old.glob('*.py'):
|
|
s=p.read_text()
|
|
for a,b in repl.items():s=s.replace(a,b)
|
|
(D/p.name).write_text(s)
|
|
for p in ['run-wanplus-document.py','wanplus-document-server.py','wanplus-document.mjs']:
|
|
s=(R/'e2e'/p).read_text()
|
|
for a,b in repl.items():s=s.replace(a,b)
|
|
(R/'e2e'/p.replace('wanplus','wanrole')).write_text(s)
|
|
rows=json.loads((oldf/'sources.json').read_bytes())['sources'];now=datetime.datetime.now(datetime.timezone.utc).isoformat()
|
|
g=json.loads((R/'example_ComfyUI_workflows/6-动作迁移/Wan2.1_Scail-2_角色迁移_WanAnimatePlus_v4.2.json').read_bytes())
|
|
versions={n.get('properties',{}).get('ver')for s in [g]+g['definitions']['subgraphs']for n in s['nodes']}
|
|
ids={e['id']for e in rows if e.get('tag')in versions or e.get('tag','').removeprefix('v')in versions}
|
|
ids.add('missing761-response')
|
|
rows=[e for e in rows if e['id']in ids or e['file'].endswith('.json') and '761' in str(e)]
|
|
for e in rows:
|
|
e['reverified_at']=now;e['prior_exact_bytes_record']=True;e['reuse_from']='wanplus-reference/'+e['local_file']
|
|
for p in oldf.iterdir():
|
|
if p.is_file()and any(p.name.startswith(k)for k in ids):shutil.copyfile(p,F/p.name)
|
|
for e in rows:
|
|
if not (F/e['local_file']).exists():shutil.copyfile(oldf/e['local_file'],F/e['local_file'])
|
|
assert hashlib.sha256((F/e['local_file']).read_bytes()).hexdigest()==e['sha256']
|
|
(F/'sources.json').write_text(json.dumps({'sources':rows},ensure_ascii=False,indent=2)+'\n')
|
|
print('reused rows',len(rows),'ids',sorted(ids))
|
|
print('all nodes',[(n['id'],n['type'],n.get('properties',{}).get('ver')) for s in [g]+g['definitions']['subgraphs']for n in s['nodes']])
|