25 lines
2.1 KiB
Python
25 lines
2.1 KiB
Python
from pathlib import Path
|
|
import json,sqlite3,subprocess,os
|
|
root=Path(__file__).resolve().parent.parent
|
|
test=root/'integration-work'/os.environ.get('HUOBAO_TEST_FOLDER','hd-test')
|
|
assert test.resolve().is_relative_to(root/'integration-work') and test.name.startswith('hd-test')
|
|
test.mkdir(exist_ok=False)
|
|
subprocess.run(['icacls',str(test),'/inheritance:r','/grant:r',os.environ['USERNAME']+':(OI)(CI)(F)','SYSTEM:(OI)(CI)(F)'],capture_output=True,check=True)
|
|
with sqlite3.connect((root/'huobao-data/huobao.sqlite3').as_uri()+'?mode=ro',uri=True) as src, sqlite3.connect(test/'huobao.sqlite3') as db:
|
|
src.backup(db)
|
|
db.execute("UPDATE sys_task SET status='failed' WHERE status='processing'")
|
|
db.execute("UPDATE video_merges SET status='failed' WHERE status='processing'")
|
|
sid,eid=db.execute('SELECT id,episode_id FROM storyboards ORDER BY id LIMIT 1').fetchone()
|
|
original='static/videos/hd-test-original.mp4'
|
|
db.execute('UPDATE storyboards SET video_url=?,video_prompt=?,duration=4 WHERE id=?',(original,'A cinematic live-action landscape of a quiet mountain lake at sunrise, light mist drifts above still water, slow camera push forward, no people, no text, no dialogue.',sid))
|
|
cfg=json.loads((root/'model-bridge/client.json').read_text())
|
|
db.execute('INSERT INTO ai_service_configs (name,service_type,provider,base_url,api_key,model,priority,is_active,created_at,updated_at) VALUES (?,?,?,?,?,?,?,?,datetime(\'now\'),datetime(\'now\'))',
|
|
('VDN test','video','localvideo','http://192.168.110.111:18794',cfg['token'],'["MiniMax-H3-VDN-H3"]',40,1))
|
|
db.commit()
|
|
(test/'static/videos').mkdir(parents=True)
|
|
ffmpeg=root/'integration-work/stage-4.0.11/app/resources/bin/ffmpeg.exe'
|
|
subprocess.run([str(ffmpeg),'-hide_banner','-loglevel','error','-f','lavfi','-i','color=c=0x547d89:s=512x288:r=24:d=4','-vf','drawbox=x=0:y=180:w=512:h=108:color=0x284c39:t=fill',
|
|
'-c:v','libx264','-pix_fmt','yuv420p',str(test/original)],check=True,creationflags=0x08000000)
|
|
(test/'fixture.json').write_text(json.dumps({'storyboard':sid,'episode':eid,'original':original}))
|
|
print('Isolated test fixture ready:',sid,eid)
|