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

22 lines
628 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:
for m in Melee.select():
print(f"rendering {m.name}...")
page.goto(f"http://localhost:8080/{m.name}")
page.locator(".container").screenshot(path=f"./output/{m.name}.png")
browser.close()