updated plugin refactor and added FTP and SCP plugins , also hydrusnetwork plugin migration
This commit is contained in:
@@ -89,6 +89,8 @@ class HydrusNetwork(Store):
|
||||
Maintains its own HydrusClient.
|
||||
"""
|
||||
|
||||
STORE_TYPE = "hydrusnetwork"
|
||||
|
||||
@classmethod
|
||||
def config_schema(cls) -> List[Dict[str, Any]]:
|
||||
return [
|
||||
@@ -1776,6 +1778,33 @@ class HydrusNetwork(Store):
|
||||
debug(f"{self._log_prefix()} delete_file failed: {exc}")
|
||||
return False
|
||||
|
||||
def build_file_url(self, file_hash: str, *, include_access_key: bool = True) -> str:
|
||||
normalized = str(file_hash or "").strip().lower()
|
||||
base_url = str(self.URL).rstrip("/")
|
||||
url = f"{base_url}/get_files/file?hash={quote(normalized)}"
|
||||
if include_access_key and str(self.API or "").strip():
|
||||
url = f"{url}&Hydrus-Client-API-Access-Key={quote(str(self.API))}"
|
||||
return url
|
||||
|
||||
def fetch_file_metadata(self, file_hash: str, **kwargs: Any) -> Optional[Dict[str, Any]]:
|
||||
try:
|
||||
client = self._client
|
||||
if client is None:
|
||||
return None
|
||||
return client.fetch_file_metadata(hashes=[str(file_hash or "").strip().lower()], **kwargs)
|
||||
except Exception:
|
||||
return None
|
||||
|
||||
def get_relationships(self, file_hash: str) -> Optional[Dict[str, Any]]:
|
||||
try:
|
||||
client = self._client
|
||||
if client is None:
|
||||
return None
|
||||
payload = client.get_file_relationships(str(file_hash or "").strip().lower())
|
||||
return payload if isinstance(payload, dict) else None
|
||||
except Exception:
|
||||
return None
|
||||
|
||||
def get_metadata(self, file_hash: str, **kwargs: Any) -> Optional[Dict[str, Any]]:
|
||||
"""Get metadata for a file from Hydrus by hash.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user