From bc3dbf28e8bf533a3e4e43447cde07e7f11c6cd7 Mon Sep 17 00:00:00 2001 From: Nose Date: Sat, 31 Jan 2026 20:24:15 -0800 Subject: [PATCH] F --- SYS/cmdlet_catalog.py | 23 +++++++++++++++++++++-- SYS/pipeline.py | 3 ++- logs/log_fallback.txt | 4 ++++ scripts/bootstrap.py | 22 ++++++++-------------- scripts/hydrusnetwork.py | 2 -- 5 files changed, 35 insertions(+), 19 deletions(-) diff --git a/SYS/cmdlet_catalog.py b/SYS/cmdlet_catalog.py index cdb76ad..4654fa6 100644 --- a/SYS/cmdlet_catalog.py +++ b/SYS/cmdlet_catalog.py @@ -75,12 +75,31 @@ def import_cmd_module(mod_name: str): return None for package in ("cmdnat", "cmdlet", None): try: + # When attempting a bare import (package is None), prefer the repo-local + # `MPV` package for the `mpv` module name so we don't accidentally + # import the third-party `mpv` package (python-mpv) which can raise + # OSError if system libmpv is missing. + if package is None and normalized == "mpv": + try: + return import_module("MPV") + except ModuleNotFoundError: + # Local MPV package not present; fall back to the normal bare import. + pass + qualified = f"{package}.{normalized}" if package else normalized return import_module(qualified) except ModuleNotFoundError: + # Module not available in this package prefix; try the next. continue - except Exception as exc: - logger.exception("Unexpected error importing module %s: %s", qualified, exc) + except (ImportError, OSError) as exc: + # Some native/binary-backed packages (e.g., mpv) raise ImportError/OSError + # on systems missing shared libraries. These are optional; log a short + # warning but avoid spamming the console with a full traceback. + logger.warning("Optional module %s failed to import: %s", qualified, exc) + continue + except Exception: + # Unexpected errors should be loud and include a traceback to aid debugging. + logger.exception("Unexpected error importing module %s", qualified) continue return None diff --git a/SYS/pipeline.py b/SYS/pipeline.py index 49732fb..108b122 100644 --- a/SYS/pipeline.py +++ b/SYS/pipeline.py @@ -1353,7 +1353,8 @@ class PipelineExecutor: def _add(value) -> None: try: text = str(value or "").strip().lower() - except Exception: + except Exception as exc: + logger.debug("Failed to normalize candidate value: %s", exc, exc_info=True) return if not text or text in seen: return diff --git a/logs/log_fallback.txt b/logs/log_fallback.txt index 04adcc7..7aa863d 100644 --- a/logs/log_fallback.txt +++ b/logs/log_fallback.txt @@ -568,3 +568,7 @@ http://10.162.158.28:45899/get_files/file?hash=5c7296f1a5544522e3d118f60080e0389 2026-01-31T03:13:22.207331Z [DEBUG] logger.debug: DEBUG: 2026-01-31T03:13:39.166965Z [DEBUG] alldebrid.search: [alldebrid] Failed to list account magnets: AllDebrid API error: The auth apikey is invalid 2026-02-01T00:05:13.728816Z [DEBUG] logger.debug: DEBUG: [Store] Unknown store type 'debrid' +2026-02-01T04:23:03.090858Z [DEBUG] logger.debug: DEBUG: [Store] Unknown store type 'debrid' +2026-02-01T04:23:19.808488Z [DEBUG] logger.debug: DEBUG: [Store] Unknown store type 'debrid' +2026-02-01T04:23:36.282589Z [DEBUG] search_file.run: Backend all-debrid search failed: "Unknown store backend: all-debrid. Available: ['rpi', 'local']" +2026-02-01T04:23:52.712154Z [DEBUG] logger.debug: DEBUG: [search-file] Searching 'local' diff --git a/scripts/bootstrap.py b/scripts/bootstrap.py index e9c652b..b7fd2da 100644 --- a/scripts/bootstrap.py +++ b/scripts/bootstrap.py @@ -1508,27 +1508,21 @@ def main() -> int: # 7. CLI Verification pb.update("Verifying CLI configuration...") - # Check core dependencies (including mpv) before finalizing + # Check core imports (skip optional python-mpv here because it depends on + # the system libmpv shared library and is not required for the repo-local + # MPV IPC integration; MPV executable availability is handled below.) try: - # Check basic imports and specifically mpv missing = [] - for mod in ["importlib", "shutil", "subprocess", "mpv"]: + for mod in ["importlib", "shutil", "subprocess"]: try: # Use run() for verification to ensure clean environment run([str(venv_python), "-c", f"import {mod}"], quiet=True) except Exception: missing.append(mod) - - if missing: - # If mpv is missing, it might be because python-mpv wasn't in requirements.txt - # or failed to install. Try installing it explicitly. - if "mpv" in missing: - try: - _run_cmd([str(venv_python), "-m", "pip", "install", "--no-cache-dir", "python-mpv"]) - missing.remove("mpv") - except Exception: - pass - + + # Note: If the MPV executable is missing it will be handled by the + # MPV installation step later in this script; do not attempt to + # install the third-party `python-mpv` package here. if missing: print(f"\nWarning: The following packages were not importable in the venv: {', '.join(missing)}") except Exception: diff --git a/scripts/hydrusnetwork.py b/scripts/hydrusnetwork.py index e3b4f22..ce81c2b 100644 --- a/scripts/hydrusnetwork.py +++ b/scripts/hydrusnetwork.py @@ -1123,7 +1123,6 @@ def main(argv: Optional[list[str]] = None) -> int: "show-in-file-manager": "showinfm", "opencv-python-headless": "cv2", "mpv": "mpv", - "python-mpv": "mpv", "pyside6": "PySide6", "pyside6-essentials": "PySide6", "pyside6-addons": "PySide6", @@ -1448,7 +1447,6 @@ def main(argv: Optional[list[str]] = None) -> int: "show-in-file-manager": "showinfm", "opencv-python-headless": "cv2", "mpv": "mpv", - "python-mpv": "mpv", "pyside6": "PySide6", "pyside6-essentials": "PySide6", "pyside6-addons": "PySide6",