s
This commit is contained in:
@@ -176,19 +176,42 @@ class Download_File(Cmdlet):
|
||||
try:
|
||||
handled, path = provider.handle_url(str(url), output_dir=final_output_dir)
|
||||
if handled:
|
||||
if path:
|
||||
extra_meta = None
|
||||
title_hint = None
|
||||
tags_hint: Optional[List[str]] = None
|
||||
media_kind_hint = None
|
||||
path_value: Optional[Any] = path
|
||||
|
||||
if isinstance(path, dict):
|
||||
path_value = path.get("path") or path.get("file_path")
|
||||
extra_meta = path.get("metadata") or path.get("full_metadata")
|
||||
title_hint = path.get("title") or path.get("name")
|
||||
media_kind_hint = path.get("media_kind")
|
||||
tags_val = path.get("tags") or path.get("tag")
|
||||
if isinstance(tags_val, (list, tuple, set)):
|
||||
tags_hint = [str(t) for t in tags_val if t]
|
||||
elif isinstance(tags_val, str) and tags_val.strip():
|
||||
tags_hint = [str(tags_val).strip()]
|
||||
|
||||
if path_value:
|
||||
p_val = Path(str(path_value))
|
||||
if not title_hint and isinstance(extra_meta, dict):
|
||||
title_hint = extra_meta.get("title") or extra_meta.get("name")
|
||||
|
||||
self._emit_local_file(
|
||||
downloaded_path=Path(str(path)),
|
||||
downloaded_path=p_val,
|
||||
source=str(url),
|
||||
title_hint=Path(str(path)).stem,
|
||||
tags_hint=None,
|
||||
media_kind_hint="file",
|
||||
full_metadata=None,
|
||||
title_hint=str(title_hint) if title_hint else p_val.stem,
|
||||
tags_hint=tags_hint,
|
||||
media_kind_hint=str(media_kind_hint) if media_kind_hint else "file",
|
||||
full_metadata=extra_meta,
|
||||
progress=progress,
|
||||
config=config,
|
||||
provider_hint=provider_name
|
||||
)
|
||||
downloaded_count += 1
|
||||
downloaded_count += 1
|
||||
else:
|
||||
debug(f"Provider {provider_name} handled URL without file output")
|
||||
continue
|
||||
except Exception as e:
|
||||
debug(f"Provider {provider_name} handle_url error: {e}")
|
||||
|
||||
Reference in New Issue
Block a user