dead-cells-wiki/data/render/31-4/render_all.py

26 lines
897 B
Python
Raw Permalink Normal View History

2022-10-16 11:23:08 +08:00
#!/usr/bin/env python3
# # -*- coding: utf-8 -*-
import sys
from playwright.sync_api import sync_playwright
sys.path.append("../../convert/31-4")
from db import *
db.bind(provider="sqlite", filename="../../clean/31-4/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()