continuing refactor
This commit is contained in:
+16
-7
@@ -203,7 +203,6 @@ class SharedArgs:
|
||||
type="string",
|
||||
description="Selects a plugin instance",
|
||||
query_key="instance",
|
||||
query_aliases=["store"],
|
||||
)
|
||||
|
||||
URL = CmdletArg(
|
||||
@@ -234,7 +233,7 @@ class SharedArgs:
|
||||
Only includes backends that successfully initialized at startup.
|
||||
|
||||
Example:
|
||||
SharedArgs.STORE.choices = SharedArgs.get_store_choices(config)
|
||||
SharedArgs.INSTANCE.choices = SharedArgs.get_store_choices(config)
|
||||
"""
|
||||
# Use the cached startup check result if available (unless force=True)
|
||||
if not force and hasattr(SharedArgs, "_cached_available_stores"):
|
||||
@@ -273,14 +272,19 @@ class SharedArgs:
|
||||
if skip_instantiation:
|
||||
return
|
||||
|
||||
names: set[str] = set()
|
||||
|
||||
# Plugin-based multi-instance backends (config["plugin"] / config["provider"] sections)
|
||||
try:
|
||||
from Store.registry import Store as StoreRegistry
|
||||
registry = StoreRegistry(config=config, suppress_debug=True)
|
||||
available = registry.list_backends()
|
||||
if available:
|
||||
SharedArgs._cached_available_stores = available
|
||||
from ProviderCore.registry import REGISTRY
|
||||
plugin_instances = REGISTRY.list_storage_plugin_instances(config)
|
||||
for _plugin_name, instance_names in plugin_instances.items():
|
||||
names.update(instance_names)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
if names:
|
||||
SharedArgs._cached_available_stores = sorted(names)
|
||||
except Exception:
|
||||
SharedArgs._cached_available_stores = []
|
||||
|
||||
@@ -4187,6 +4191,11 @@ def check_url_exists_in_storage(
|
||||
is_hydrus_backend = bool(hydrus_provider and hydrus_provider.is_backend(backend, str(backend_name)))
|
||||
except Exception:
|
||||
is_hydrus_backend = False
|
||||
if not is_hydrus_backend:
|
||||
try:
|
||||
is_hydrus_backend = str(getattr(backend, "STORE_TYPE", "")).strip().lower() == "hydrusnetwork"
|
||||
except Exception:
|
||||
is_hydrus_backend = False
|
||||
|
||||
if is_hydrus_backend:
|
||||
if not hydrus_available:
|
||||
|
||||
Reference in New Issue
Block a user