f
This commit is contained in:
@@ -454,6 +454,7 @@ class HydrusNetwork(Store):
|
||||
results = storage["hydrus"].search("Simple Man")
|
||||
"""
|
||||
limit = kwargs.get("limit", 100)
|
||||
minimal = bool(kwargs.get("minimal", False))
|
||||
|
||||
try:
|
||||
client = self._client
|
||||
@@ -518,6 +519,8 @@ class HydrusNetwork(Store):
|
||||
fetch_limit: int,
|
||||
scan_limit: int | None = None,
|
||||
needles: Optional[Sequence[str]] = None,
|
||||
*,
|
||||
minimal: bool = False,
|
||||
) -> list[dict[str, Any]]:
|
||||
"""Best-effort URL search by scanning Hydrus metadata with include_file_url=True."""
|
||||
|
||||
@@ -620,19 +623,19 @@ class HydrusNetwork(Store):
|
||||
payload = client.fetch_file_metadata(
|
||||
hashes=chunk,
|
||||
include_file_url=True,
|
||||
include_service_keys_to_tags=True,
|
||||
include_duration=True,
|
||||
include_size=True,
|
||||
include_mime=True,
|
||||
include_service_keys_to_tags=not minimal,
|
||||
include_duration=not minimal,
|
||||
include_size=not minimal,
|
||||
include_mime=not minimal,
|
||||
)
|
||||
else:
|
||||
payload = client.fetch_file_metadata(
|
||||
file_ids=chunk,
|
||||
include_file_url=True,
|
||||
include_service_keys_to_tags=True,
|
||||
include_duration=True,
|
||||
include_size=True,
|
||||
include_mime=True,
|
||||
include_service_keys_to_tags=not minimal,
|
||||
include_duration=not minimal,
|
||||
include_size=not minimal,
|
||||
include_mime=not minimal,
|
||||
)
|
||||
except Exception:
|
||||
continue
|
||||
@@ -739,12 +742,14 @@ class HydrusNetwork(Store):
|
||||
want_any=False,
|
||||
fetch_limit=int(limit) if limit else 100,
|
||||
needles=pattern_hints,
|
||||
minimal=minimal,
|
||||
)
|
||||
else:
|
||||
metadata_list = _iter_url_filtered_metadata(
|
||||
None,
|
||||
want_any=True,
|
||||
fetch_limit=int(limit) if limit else 100
|
||||
fetch_limit=int(limit) if limit else 100,
|
||||
minimal=minimal,
|
||||
)
|
||||
else:
|
||||
def _clean_url_search_token(value: str | None) -> str:
|
||||
@@ -792,10 +797,10 @@ class HydrusNetwork(Store):
|
||||
payload = client.fetch_file_metadata(
|
||||
file_ids=file_ids,
|
||||
include_file_url=True,
|
||||
include_service_keys_to_tags=True,
|
||||
include_duration=True,
|
||||
include_size=True,
|
||||
include_mime=True,
|
||||
include_service_keys_to_tags=not minimal,
|
||||
include_duration=not minimal,
|
||||
include_size=not minimal,
|
||||
include_mime=not minimal,
|
||||
)
|
||||
metas = (
|
||||
payload.get("metadata",
|
||||
@@ -810,10 +815,10 @@ class HydrusNetwork(Store):
|
||||
payload = client.fetch_file_metadata(
|
||||
hashes=hashes,
|
||||
include_file_url=True,
|
||||
include_service_keys_to_tags=True,
|
||||
include_duration=True,
|
||||
include_size=True,
|
||||
include_mime=True,
|
||||
include_service_keys_to_tags=not minimal,
|
||||
include_duration=not minimal,
|
||||
include_size=not minimal,
|
||||
include_mime=not minimal,
|
||||
)
|
||||
metas = (
|
||||
payload.get("metadata",
|
||||
@@ -844,6 +849,7 @@ class HydrusNetwork(Store):
|
||||
fetch_limit=int(limit) if limit else 100,
|
||||
scan_limit=scan_limit_override,
|
||||
needles=pattern_hints if pattern_hints else None,
|
||||
minimal=minimal,
|
||||
)
|
||||
elif namespace == "system":
|
||||
normalized_system_predicate = pattern.strip()
|
||||
@@ -857,6 +863,7 @@ class HydrusNetwork(Store):
|
||||
want_any=not bool(pattern_hints),
|
||||
fetch_limit=fetch_limit,
|
||||
needles=pattern_hints if pattern_hints else None,
|
||||
minimal=minimal,
|
||||
)
|
||||
|
||||
# Parse the query into tags
|
||||
|
||||
Reference in New Issue
Block a user