From f4283759e1fe1364a5b6e508100989d71c326e49 Mon Sep 17 00:00:00 2001 From: Nose Date: Sun, 11 Jan 2026 01:14:45 -0800 Subject: [PATCH] k --- API/alldebrid.py | 4 +--- Provider/alldebrid.py | 8 +------- Provider/openlibrary.py | 11 +---------- SYS/rich_display.py | 44 ++--------------------------------------- cmdlet/search_file.py | 29 +-------------------------- cmdnat/worker.py | 2 +- 6 files changed, 7 insertions(+), 91 deletions(-) diff --git a/API/alldebrid.py b/API/alldebrid.py index 3da0a48..2c21f09 100644 --- a/API/alldebrid.py +++ b/API/alldebrid.py @@ -16,7 +16,6 @@ import time from urllib.parse import urlparse from SYS.logger import log, debug -from SYS.rich_display import show_provider_config_panel from .HTTP import HTTPClient logger = logging.getLogger(__name__) @@ -1105,9 +1104,8 @@ def unlock_link_cmdlet(result: Any, args: Sequence[str], config: Dict[str, Any]) api_key = _get_alldebrid_api_key_from_config(config) if not api_key: - show_provider_config_panel("alldebrid", ["api_key"]) log( - "AllDebrid API key not configured (provider.alldebrid.api_key)", + "AllDebrid API key not configured. Use .config to set it.", file=sys.stderr ) return 1 diff --git a/Provider/alldebrid.py b/Provider/alldebrid.py index 2c9eea9..6bc5dfd 100644 --- a/Provider/alldebrid.py +++ b/Provider/alldebrid.py @@ -311,13 +311,7 @@ def prepare_magnet( ) -> tuple[Optional[AllDebridClient], Optional[int]]: api_key = _get_debrid_api_key(config or {}) if not api_key: - try: - from SYS.rich_display import show_provider_config_panel - - show_provider_config_panel("alldebrid", ["api_key"]) - except Exception: - pass - log("AllDebrid API key not configured (provider.alldebrid.api_key)", file=sys.stderr) + log("AllDebrid API key not configured. Use .config to set it.", file=sys.stderr) return None, None try: diff --git a/Provider/openlibrary.py b/Provider/openlibrary.py index 27bf76b..88f8de8 100644 --- a/Provider/openlibrary.py +++ b/Provider/openlibrary.py @@ -1187,18 +1187,9 @@ class OpenLibrary(Provider): email, password = self._credential_archive(self.config or {}) if not email or not password: log( - "[openlibrary] Archive credentials missing; cannot borrow", + "[openlibrary] Archive credentials missing; cannot borrow. Use .config to set them.", file=sys.stderr ) - try: - from SYS.rich_display import show_provider_config_panel - - show_provider_config_panel( - "openlibrary", - keys=self.required_config_keys(), - ) - except Exception: - pass return None lendable = True diff --git a/SYS/rich_display.py b/SYS/rich_display.py index c2047c3..d80a288 100644 --- a/SYS/rich_display.py +++ b/SYS/rich_display.py @@ -81,27 +81,7 @@ def show_provider_config_panel( config_hint: str = "config.conf" ) -> None: """Show a Rich panel explaining how to configure a provider.""" - - normalized = str(provider_name or "").strip() or "provider" - pre = Text("Add this to your config", style="bold") - footer = Text( - f"Place this block in {config_hint} or config.d/*.conf", - style="dim" - ) - body = Text() - body.append(f"[provider={normalized}]\n", style="bold cyan") - for key in keys or []: - body.append(f'{key}=""\n', style="yellow") - - stderr_console().print(pre) - stderr_console().print( - Panel( - body, - title=f"{normalized} configuration", - expand=False - ) - ) - stderr_console().print(footer) + pass def show_store_config_panel( @@ -111,25 +91,5 @@ def show_store_config_panel( config_hint: str = "config.conf" ) -> None: """Show a Rich panel explaining how to configure a storage backend.""" - - normalized = str(store_type or "").strip().lower() or "store" - pre = Text("Add this to your config", style="bold") - footer = Text( - f"Place this block in {config_hint} or config.d/*.conf", - style="dim" - ) - body = Text() - body.append(f"[store={normalized}]\n", style="bold cyan") - for key in keys or []: - body.append(f'{key}=""\n', style="yellow") - - stderr_console().print(pre) - stderr_console().print( - Panel( - body, - title=f"{normalized} storage configuration", - expand=False - ) - ) - stderr_console().print(footer) + pass diff --git a/cmdlet/search_file.py b/cmdlet/search_file.py index 8a68591..c92cbc2 100644 --- a/cmdlet/search_file.py +++ b/cmdlet/search_file.py @@ -555,34 +555,7 @@ class search_file(Cmdlet): worker_id = str(uuid.uuid4()) library_root = get_local_storage_path(config or {}) if not library_root: - log("No library root configured", file=sys.stderr) - log("", file=sys.stderr) - - # Show config panel for FolderStore - try: - from SYS.rich_display import show_store_config_panel - show_store_config_panel("folder", ["NAME", "PATH"]) - log("", file=sys.stderr) - except Exception: - log("Example config for FolderStore:", file=sys.stderr) - log("[store=folder]", file=sys.stderr) - log('NAME="default"', file=sys.stderr) - log('PATH="/path/to/library"', file=sys.stderr) - log("", file=sys.stderr) - - # Show config panel for HydrusNetworkStore - try: - from SYS.rich_display import show_store_config_panel - show_store_config_panel("hydrusnetwork", ["NAME", "API", "URL"]) - log("", file=sys.stderr) - except Exception: - log("Example config for HydrusNetworkStore:", file=sys.stderr) - log("[store=hydrusnetwork]", file=sys.stderr) - log('NAME="default"', file=sys.stderr) - log('API="your-api-key"', file=sys.stderr) - log('URL="http://localhost:45869"', file=sys.stderr) - log("", file=sys.stderr) - + log("No library root configured. Use the .config command to set up storage.", file=sys.stderr) return 1 # Use context manager to ensure database is always closed diff --git a/cmdnat/worker.py b/cmdnat/worker.py index 216c0b5..3c8259d 100644 --- a/cmdnat/worker.py +++ b/cmdnat/worker.py @@ -103,7 +103,7 @@ def _run(result: Any, args: Sequence[str], config: Dict[str, Any]) -> int: library_root = get_local_storage_path(config or {}) if not library_root: - log("No library root configured", file=sys.stderr) + log("No library root configured. Use the .config command to set up storage.", file=sys.stderr) return 1 try: