Files
aigc-home/docs/hel-892/animate-document-evidence/extend-animate.py.txt
T
2026-11-01 20:40:33 +08:00

24 lines
3.3 KiB
Plaintext

from pathlib import Path
import json,hashlib,datetime,subprocess,concurrent.futures,shutil
R=Path.cwd();REF=R/'docs/hel-892/animate-reference';now=datetime.datetime.now(datetime.timezone.utc).isoformat();rows=json.loads((REF/'sources.json').read_bytes())['sources']
selections={'pose-e63d6e71':['models/onnx_models.py','utils.py','pose_utils/pose2d_utils.py','pose_utils/human_visualization.py','retarget_pose.py'],'wan-e5ef9752':['nodes_utility.py']}
for key,files in selections.items():
e=next(x for x in rows if x['id']==key);tree=json.loads((REF/(key+'-tree.json')).read_bytes())['tree']
for f in files:
ent=next(x for x in tree if x['path']==f);raw=subprocess.check_output(['git','-C',str(R/('.local-evidence/animate-'+key+'-git')),'show',e['commit']+':'+f],timeout=80);assert len(raw)<3000000;name=key+'__'+f.replace('/','__');(REF/name).write_bytes(raw);rows.append(dict(e,file=f,local_file=name,url=f'https://raw.githubusercontent.com/{e["repo"]}/{e["commit"]}/{f}',sha256=hashlib.sha256(raw).hexdigest(),git_blob_sha1=ent['sha'],acquisition_time=now,reverified_at=now))
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-','animate-'))
extra=fetch(('easy134extra','yolain/ComfyUI-Easy-Use','v1.3.4',['py/libs/any.py','py/libs/utils.py','web_version/v2/js/easy/easy.js','web_version/v2/js/easy/logic.js','web_version/v2/js/easy/easyDynamicWidgets.js','requirements.txt']))
for e in extra:
e.update(id='easy134',identity_key='easy134extra',license_file='easy134__license-source');rows.append(e)
keep={'core0357':{'nodes.py','LICENSE','requirements.txt'},'core051':{'nodes.py','LICENSE','comfy_extras/nodes_post_processing.py'},'cr':{'__init__.py','node_mappings.py','nodes/nodes_core.py'},'easy134':{'py/nodes/logic.py','__init__.py','pyproject.toml','LICENSE','requirements.txt','py/libs/any.py','py/libs/utils.py','web_version/v2/js/easy/easy.js','web_version/v2/js/easy/logic.js','web_version/v2/js/easy/easyDynamicWidgets.js'}}
removed=[e for e in rows if e['id']in keep and e['file']not in keep[e['id']]];rows=[e for e in rows if e not in removed];quarantine=R/'.local-evidence/animate-unneeded-initial-reuse';quarantine.mkdir(exist_ok=True)
for e in removed:
p=REF/e['local_file']
if p.exists():p.rename(quarantine/p.name)
for e in rows:
if not (REF/e['license_file']).is_file()and not e['license_file'].startswith('未知'):
e['license_file']=next((x['local_file']for x in rows if x['id']==e['id']and x['file']=='LICENSE'),'未知:准确树所选路径无许可,保留缺口')
for key,version in [('missing761','761b1d191e50d589465e31dc0d40ff7c59b1b7b0'),('missing2bdd','2bdd81a10b03c14443c79bdf3b783b1feb3d1fa3')]:
f=('761b'if key=='missing761'else'2bdd')+'-current-response.json';raw=(REF/f).read_bytes();rows.append(dict(id=key,file=f,local_file=f,tag=version,commit='',tree='未知:准确提交未取得',url='https://api.github.com/repos/kijai/ComfyUI-WanVideoWrapper/commits/'+version,sha256=hashlib.sha256(raw).hexdigest(),license_file='未知:准确实现未取得',acquisition_time=now,reverified_at=now,applicability='本图规范仓准确提交本轮HTTP422;具体未取得,不是源码不存在证明'))
(REF/'sources.json').write_text(json.dumps({'sources':rows},ensure_ascii=False,indent=2)+'\n');print('FINAL SOURCES',len(rows),flush=True)