dead-cells-wiki/data/render/31-2/render_all.py
2022-10-07 11:37:25 +08:00

25 lines
897 B
Python
Executable file

#!/usr/bin/env python3
# # -*- coding: utf-8 -*-
import sys
from playwright.sync_api import sync_playwright
sys.path.append("../../convert/31-2")
from db import *
db.bind(provider="sqlite", filename="../../clean/31-2/data.sqlite3")
db.generate_mapping()
with sync_playwright() as p:
browser = p.chromium.launch()
page = browser.new_page(device_scale_factor=3)
with db_session:
for m in [*Melee.select(), *Shield.select(), *Ranged.select()]:
print(f"rendering {m.name}...")
page.goto(f"http://localhost:8080/weapon/{m.name}")
page.locator(".container").screenshot(path=f"./output/{m.name}.png")
for o in Outfit.select():
print(f"rendering {o.name}...")
page.goto(f"http://localhost:8080/outfit/{o.name}")
page.locator(".container").screenshot(path=f"./output/{o.name}.png")
browser.close()