updated plugin refactor and added FTP and SCP plugins , also hydrusnetwork plugin migration
This commit is contained in:
@@ -980,10 +980,14 @@ class Download_File(Cmdlet):
|
||||
) -> Optional[str]:
|
||||
if storage is None or not canonical_url:
|
||||
return None
|
||||
hydrus_provider = None
|
||||
try:
|
||||
from Store.HydrusNetwork import HydrusNetwork
|
||||
registry_helpers = cls._load_provider_registry()
|
||||
get_plugin = registry_helpers.get("get_plugin")
|
||||
if callable(get_plugin):
|
||||
hydrus_provider = get_plugin("hydrusnetwork", {})
|
||||
except Exception:
|
||||
HydrusNetwork = None # type: ignore
|
||||
hydrus_provider = None
|
||||
|
||||
try:
|
||||
backend_names = list(storage.list_searchable_backends() or [])
|
||||
@@ -1001,13 +1005,13 @@ class Download_File(Cmdlet):
|
||||
except Exception:
|
||||
pass
|
||||
try:
|
||||
if HydrusNetwork is not None and isinstance(backend, HydrusNetwork) and not hydrus_available:
|
||||
if hydrus_provider is not None and hydrus_provider.is_backend(backend, str(backend_name)) and not hydrus_available:
|
||||
continue
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
try:
|
||||
if HydrusNetwork is not None and isinstance(backend, HydrusNetwork):
|
||||
if hydrus_provider is not None and hydrus_provider.is_backend(backend, str(backend_name)):
|
||||
hashes = backend.find_hashes_by_url(canonical_url) or []
|
||||
for existing_hash in hashes:
|
||||
normalized = sh.normalize_hash(existing_hash)
|
||||
|
||||
Reference in New Issue
Block a user