refactored config plugin defintions
This commit is contained in:
+15
-1
@@ -1684,7 +1684,8 @@ def _run(result: Any, args: Sequence[str], config: Dict[str, Any]) -> int:
|
||||
|
||||
format_value = parsed.get("format")
|
||||
capture_mode_value = _normalize_capture_mode(parsed.get("capture_mode"))
|
||||
quality_value = _normalize_quality(parsed.get("quality"))
|
||||
raw_quality_value = parsed.get("quality")
|
||||
quality_value: Optional[int] = None
|
||||
if not format_value:
|
||||
try:
|
||||
tool_cfg = config.get("tool", {}) if isinstance(config, dict) else {}
|
||||
@@ -1696,6 +1697,19 @@ def _run(result: Any, args: Sequence[str], config: Dict[str, Any]) -> int:
|
||||
if not format_value:
|
||||
format_value = "webp"
|
||||
|
||||
if raw_quality_value not in (None, ""):
|
||||
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
|
||||
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:
|
||||
quality_value = None
|
||||
if quality_value is None:
|
||||
quality_value = _normalize_quality(None)
|
||||
|
||||
storage_value = parsed.get("storage")
|
||||
selector_arg = parsed.get("selector")
|
||||
selectors = [selector_arg] if selector_arg else []
|
||||
|
||||
Reference in New Issue
Block a user