fdf
This commit is contained in:
@@ -18,6 +18,7 @@ from typing import Any, Dict, List, Optional, Sequence, Tuple
|
||||
from urllib.parse import urlsplit, quote, urljoin, unquote
|
||||
|
||||
from SYS.logger import log, debug, is_debug_enabled
|
||||
from SYS.item_accessors import extract_item_tags, get_result_title
|
||||
from API.HTTP import HTTPClient
|
||||
from SYS.pipeline_progress import PipelineProgress
|
||||
from SYS.utils import ensure_directory, unique_path, unique_preserve_order
|
||||
@@ -1005,26 +1006,10 @@ def _run(result: Any, args: Sequence[str], config: Dict[str, Any]) -> int:
|
||||
# ========================================================================
|
||||
|
||||
def _extract_item_tags(item: Any) -> List[str]:
|
||||
if item is None:
|
||||
return []
|
||||
raw = get_field(item, "tag")
|
||||
if isinstance(raw, list):
|
||||
return [str(t) for t in raw if t is not None and str(t).strip()]
|
||||
if isinstance(raw, str) and raw.strip():
|
||||
return [raw.strip()]
|
||||
return []
|
||||
return extract_item_tags(item)
|
||||
|
||||
def _extract_item_title(item: Any) -> str:
|
||||
if item is None:
|
||||
return ""
|
||||
for key in ("title", "name", "filename"):
|
||||
val = get_field(item, key)
|
||||
if val is None:
|
||||
continue
|
||||
text = str(val).strip()
|
||||
if text:
|
||||
return text
|
||||
return ""
|
||||
return get_result_title(item, "title", "name", "filename") or ""
|
||||
|
||||
def _clean_title(text: str) -> str:
|
||||
value = (text or "").strip()
|
||||
|
||||
Reference in New Issue
Block a user