updated plugin refactor and added FTP and SCP plugins , also hydrusnetwork plugin migration
This commit is contained in:
@@ -9,9 +9,9 @@ import sys
|
||||
|
||||
from SYS.logger import log
|
||||
from SYS.item_accessors import get_sha256_hex, get_store_name
|
||||
from ProviderCore.registry import get_plugin
|
||||
|
||||
from SYS import pipeline as ctx
|
||||
from API import HydrusNetwork as hydrus_wrapper
|
||||
from . import _shared as sh
|
||||
|
||||
Cmdlet = sh.Cmdlet
|
||||
@@ -617,16 +617,20 @@ def _run(result: Any, _args: Sequence[str], config: Dict[str, Any]) -> int:
|
||||
# - If no store is specified, use the default Hydrus client.
|
||||
# NOTE: When a store is specified, we do not fall back to a global/default Hydrus client.
|
||||
hydrus_client = None
|
||||
hydrus_provider = get_plugin("hydrusnetwork", config)
|
||||
if store_name and (not is_folder_store) and backend is not None:
|
||||
try:
|
||||
candidate = getattr(backend, "_client", None)
|
||||
if candidate is not None and hasattr(candidate, "set_relationship"):
|
||||
hydrus_client = candidate
|
||||
if hydrus_provider is not None:
|
||||
hydrus_client = hydrus_provider.get_client(
|
||||
store_name=str(store_name),
|
||||
allow_default=False,
|
||||
)
|
||||
except Exception:
|
||||
hydrus_client = None
|
||||
elif not store_name:
|
||||
try:
|
||||
hydrus_client = hydrus_wrapper.get_client(config)
|
||||
if hydrus_provider is not None:
|
||||
hydrus_client = hydrus_provider.get_client()
|
||||
except Exception:
|
||||
hydrus_client = None
|
||||
|
||||
@@ -1049,8 +1053,9 @@ def _run(result: Any, _args: Sequence[str], config: Dict[str, Any]) -> int:
|
||||
return 1
|
||||
|
||||
# Build Hydrus client
|
||||
hydrus_provider = get_plugin("hydrusnetwork", config)
|
||||
try:
|
||||
hydrus_client = hydrus_wrapper.get_client(config)
|
||||
hydrus_client = hydrus_provider.get_client() if hydrus_provider is not None else None
|
||||
except Exception as exc:
|
||||
log(f"Hydrus client unavailable: {exc}", file=sys.stderr)
|
||||
return 1
|
||||
|
||||
Reference in New Issue
Block a user