df
Some checks failed
smoke-mm / Install & smoke test mm --help (push) Has been cancelled

This commit is contained in:
2025-12-27 14:50:59 -08:00
parent 22af776ee2
commit fcdd507d00
12 changed files with 1004 additions and 66 deletions

View File

@@ -373,6 +373,29 @@ class HydrusNetwork:
body = {"hashes": hash_list}
return self._post("/add_files/undelete_files", data=body)
def delete_files(self, hashes: Union[str, Iterable[str]], *, reason: str | None = None) -> dict[str, Any]:
"""Delete files in Hydrus.
Hydrus Client API: POST /add_files/delete_files
Required JSON args: {"hashes": [<sha256 hex>, ...]}
Optional JSON args: {"reason": "..."}
"""
hash_list = self._ensure_hashes(hashes)
body: dict[str, Any] = {"hashes": hash_list}
if isinstance(reason, str) and reason.strip():
body["reason"] = reason.strip()
return self._post("/add_files/delete_files", data=body)
def clear_file_deletion_record(self, hashes: Union[str, Iterable[str]]) -> dict[str, Any]:
"""Clear Hydrus's file deletion record for the provided hashes.
Hydrus Client API: POST /add_files/clear_file_deletion_record
Required JSON args: {"hashes": [<sha256 hex>, ...]}
"""
hash_list = self._ensure_hashes(hashes)
body = {"hashes": hash_list}
return self._post("/add_files/clear_file_deletion_record", data=body)
def add_tag(self, hash: Union[str, Iterable[str]], tags: Iterable[str], service_name: str) -> dict[str, Any]:
hash = self._ensure_hashes(hash)
body = {"hashes": hash, "service_names_to_tags": {service_name: list(tags)}}