update and cleanup repo
This commit is contained in:
+16
-16
@@ -43,7 +43,7 @@ from SYS import pipeline as pipeline_context
|
||||
# Playwright & Screenshot Dependencies
|
||||
# ============================================================================
|
||||
|
||||
from tool.playwright import PlaywrightTimeoutError, PlaywrightTool
|
||||
from plugins.playwright import PlaywrightTimeoutError, PlaywrightTool
|
||||
|
||||
try:
|
||||
from SYS.config import resolve_output_dir
|
||||
@@ -1525,22 +1525,22 @@ def _capture(
|
||||
{}) or {})
|
||||
except Exception:
|
||||
base_cfg = {}
|
||||
tool_block = dict(base_cfg.get("tool") or {}
|
||||
plugin_block = dict(base_cfg.get("plugin") or {}
|
||||
) if isinstance(base_cfg,
|
||||
dict) else {}
|
||||
pw_block = (
|
||||
dict(tool_block.get("playwright") or {})
|
||||
if isinstance(tool_block,
|
||||
dict(plugin_block.get("playwright") or {})
|
||||
if isinstance(plugin_block,
|
||||
dict) else {}
|
||||
)
|
||||
pw_block["browser"] = "chromium"
|
||||
tool_block["playwright"] = pw_block
|
||||
plugin_block["playwright"] = pw_block
|
||||
if isinstance(base_cfg, dict):
|
||||
base_cfg["tool"] = tool_block
|
||||
base_cfg["plugin"] = plugin_block
|
||||
tool = PlaywrightTool(base_cfg)
|
||||
except Exception:
|
||||
tool = PlaywrightTool({
|
||||
"tool": {
|
||||
"plugin": {
|
||||
"playwright": {
|
||||
"browser": "chromium"
|
||||
}
|
||||
@@ -1888,8 +1888,8 @@ def _run(result: Any, args: Sequence[str], config: Dict[str, Any]) -> int:
|
||||
quality_value: Optional[int] = None
|
||||
if not format_value:
|
||||
try:
|
||||
tool_cfg = config.get("tool", {}) if isinstance(config, dict) else {}
|
||||
pw_cfg = tool_cfg.get("playwright") if isinstance(tool_cfg, dict) else None
|
||||
plugin_cfg = config.get("plugin", {}) if isinstance(config, dict) else {}
|
||||
pw_cfg = plugin_cfg.get("playwright") if isinstance(plugin_cfg, dict) else None
|
||||
if isinstance(pw_cfg, dict):
|
||||
format_value = pw_cfg.get("format")
|
||||
except Exception:
|
||||
@@ -1901,8 +1901,8 @@ def _run(result: Any, args: Sequence[str], config: Dict[str, Any]) -> int:
|
||||
quality_value = _normalize_quality(raw_quality_value)
|
||||
else:
|
||||
try:
|
||||
tool_cfg = config.get("tool", {}) if isinstance(config, dict) else {}
|
||||
pw_cfg = tool_cfg.get("playwright") if isinstance(tool_cfg, dict) else None
|
||||
plugin_cfg = config.get("plugin", {}) if isinstance(config, dict) else {}
|
||||
pw_cfg = plugin_cfg.get("playwright") if isinstance(plugin_cfg, dict) else None
|
||||
if isinstance(pw_cfg, dict) and pw_cfg.get("screenshot_quality") not in (None, ""):
|
||||
quality_value = _normalize_quality(pw_cfg.get("screenshot_quality"))
|
||||
except Exception:
|
||||
@@ -1994,18 +1994,18 @@ def _run(result: Any, args: Sequence[str], config: Dict[str, Any]) -> int:
|
||||
shared_playwright_tool: Optional[PlaywrightTool] = None
|
||||
try:
|
||||
if isinstance(config, dict):
|
||||
tool_block = dict(config.get("tool") or {})
|
||||
pw_block = dict(tool_block.get("playwright") or {})
|
||||
plugin_block = dict(config.get("plugin") or {})
|
||||
pw_block = dict(plugin_block.get("playwright") or {})
|
||||
pw_block["browser"] = "chromium"
|
||||
pw_block["user_agent"] = "native"
|
||||
pw_block["viewport_width"] = int(DEFAULT_VIEWPORT.get("width", 1920))
|
||||
pw_block["viewport_height"] = int(DEFAULT_VIEWPORT.get("height", 1080))
|
||||
tool_block["playwright"] = pw_block
|
||||
plugin_block["playwright"] = pw_block
|
||||
pw_local_cfg = dict(config)
|
||||
pw_local_cfg["tool"] = tool_block
|
||||
pw_local_cfg["plugin"] = plugin_block
|
||||
else:
|
||||
pw_local_cfg = {
|
||||
"tool": {
|
||||
"plugin": {
|
||||
"playwright": {
|
||||
"browser": "chromium",
|
||||
"user_agent": "native",
|
||||
|
||||
Reference in New Issue
Block a user