39 lines
2.8 KiB
Plaintext
39 lines
2.8 KiB
Plaintext
from pathlib import Path
|
|
import json,hashlib,datetime,subprocess,concurrent.futures,urllib.request
|
|
R=Path.cwd();REF=R/'docs/hel-892/wanplus-reference';OUT=R/'docs/hel-892/wanplus-document-evidence';REF.mkdir(exist_ok=True);OUT.mkdir(exist_ok=True)
|
|
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())
|
|
specs={}
|
|
for n in G['nodes']+G['definitions']['subgraphs'][0]['nodes']:
|
|
p=n.get('properties',{});v=p.get('ver');cnr=p.get('cnr_id','');aux=p.get('aux_id','')
|
|
if not v:continue
|
|
if cnr=='comfy-core': repo='Comfy-Org/ComfyUI';rev='v'+v;key='core'+v.replace('.','');files=['nodes.py','LICENSE','requirements.txt']
|
|
else:
|
|
repo=aux or {'ComfyUI-WanVideoWrapper':'kijai/ComfyUI-WanVideoWrapper','comfyui-kjnodes':'kijai/ComfyUI-KJNodes','comfyui-videohelpersuite':'Kosinkadink/ComfyUI-VideoHelperSuite','rgthree-comfy':'rgthree/rgthree-comfy','ComfyLiterals':'M1kep/ComfyLiterals','was-ns':'WASasquatch/was-node-suite-comfyui'}[cnr]
|
|
rev=v;key=repo.split('/')[-1].lower().replace('comfyui-','')+'-'+v[:8];files=['__init__.py','LICENSE','requirements.txt','pyproject.toml']
|
|
specs[key]=(key,repo,rev,files)
|
|
(REF/'requested-specs.json').write_text(json.dumps(specs,ensure_ascii=False,indent=2)+'\n')
|
|
s=(R/'.local-evidence/setup-anima.py').read_text();exec('def fetch(spec):'+s.split('def fetch(spec):')[1].split('with concurrent.futures')[0].replace('anima-','wanplus-'))
|
|
rows=[];failures=[]
|
|
with concurrent.futures.ThreadPoolExecutor(max_workers=4)as pool:
|
|
futs={pool.submit(fetch,s):s for s in specs.values()}
|
|
for fut in concurrent.futures.as_completed(futs):
|
|
try:rows+=fut.result()
|
|
except Exception as e:
|
|
failures.append(dict(spec=futs[fut],error=str(e)));print('FAILED',futs[fut][0],str(e),flush=True)
|
|
# Preserve genuine first acquisition metadata where these exact bytes were already recorded.
|
|
old=[]
|
|
for p in (R/'docs/hel-892').glob('*reference/sources.json'):
|
|
if p.parent==REF:continue
|
|
try:rr=json.loads(p.read_bytes())['sources']
|
|
except (KeyError,TypeError):continue
|
|
old+=rr
|
|
for e in rows:
|
|
before=next((x for x in old if x.get('commit')==e['commit'] and x.get('file')==e['file'] and x.get('sha256')==e['sha256']),None)
|
|
if before:e['acquisition_time']=before.get('acquisition_time','未知:旧记录未载首次获取时间');e['prior_exact_bytes_record']=True
|
|
for e in rows:
|
|
e['license_file']=next((x['local_file'] for x in rows if x['id']==e['id'] and x['file']=='LICENSE'),'未知:准确所选路径无许可')
|
|
(REF/'sources.json').write_text(json.dumps(dict(sources=rows),ensure_ascii=False,indent=2)+'\n')
|
|
(REF/'fetch-failures.json').write_text(json.dumps(failures,ensure_ascii=False,indent=2)+'\n')
|
|
print('ROWS',len(rows),'FAILURES',len(failures),flush=True)
|