updated plugin refactor and added FTP and SCP plugins , also hydrusnetwork plugin migration

This commit is contained in:
2026-04-27 21:17:53 -07:00
parent bfd5c20dc3
commit 8685fbb723
24 changed files with 3650 additions and 405 deletions
+23 -8
View File
@@ -136,7 +136,28 @@ class ProviderRegistry:
self._discovered = False
self._external_dirs_scanned = False
def _ensure_builtin_package_dirs(self) -> None:
if self._builtin_package_dirs or not self.package_name:
return
try:
package = importlib.import_module(self.package_name)
except Exception:
return
package_path = getattr(package, "__path__", None)
if not package_path:
return
builtin_dirs: List[Path] = []
for entry in package_path:
try:
builtin_dirs.append(Path(str(entry)).resolve())
except Exception:
builtin_dirs.append(Path(str(entry)))
self._builtin_package_dirs = tuple(builtin_dirs)
def _is_builtin_package_dir(self, candidate: Path) -> bool:
self._ensure_builtin_package_dirs()
try:
resolved = candidate.resolve()
except Exception:
@@ -253,6 +274,7 @@ class ProviderRegistry:
if self._external_dirs_scanned:
return
self._external_dirs_scanned = True
self._ensure_builtin_package_dirs()
for plugin_dir in _iter_external_plugin_dirs():
if self._is_builtin_package_dir(plugin_dir):
@@ -302,15 +324,8 @@ class ProviderRegistry:
return
self._register_module(package)
self._ensure_builtin_package_dirs()
package_path = getattr(package, "__path__", None)
if package_path:
builtin_dirs: List[Path] = []
for entry in package_path:
try:
builtin_dirs.append(Path(str(entry)).resolve())
except Exception:
builtin_dirs.append(Path(str(entry)))
self._builtin_package_dirs = tuple(builtin_dirs)
if not package_path:
self._discover_external_plugins()
return