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

26 lines
897 B
Python
Raw Normal View History

2022-09-29 11:28:58 +08:00
#!/usr/bin/env python3
# # -*- coding: utf-8 -*-
import sys
from playwright.sync_api import sync_playwright
2022-09-30 20:53:40 +08:00
sys.path.append("../../convert/31-2")
2022-09-29 11:28:58 +08:00
from db import *
2022-09-30 20:53:40 +08:00
db.bind(provider="sqlite", filename="../../clean/31-2/data.sqlite3")
2022-09-29 14:29:02 +08:00
db.generate_mapping()
2022-09-29 11:28:58 +08:00
with sync_playwright() as p:
browser = p.chromium.launch()
2022-09-30 19:30:12 +08:00
page = browser.new_page(device_scale_factor=3)
2022-09-29 11:28:58 +08:00
with db_session:
2022-10-03 17:31:11 +08:00
for m in [*Melee.select(), *Shield.select(), *Ranged.select()]:
2022-09-29 11:28:58 +08:00
print(f"rendering {m.name}...")
2022-10-07 11:37:25 +08:00
page.goto(f"http://localhost:8080/weapon/{m.name}")
2022-09-29 11:28:58 +08:00
page.locator(".container").screenshot(path=f"./output/{m.name}.png")
2022-10-07 11:37:25 +08:00
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")
2022-09-29 11:28:58 +08:00
browser.close()