hh
This commit is contained in:
@@ -504,9 +504,15 @@ class Add_File(Cmdlet):
|
||||
# When add-file -store is the last stage, always show a final search-file table.
|
||||
# This is especially important for multi-item ingests (e.g., multi-clip downloads)
|
||||
# so the user always gets a selectable ResultTable.
|
||||
live_progress = None
|
||||
try:
|
||||
live_progress = ctx.get_live_progress()
|
||||
except Exception:
|
||||
live_progress = None
|
||||
|
||||
want_final_search_file = (
|
||||
bool(is_last_stage) and bool(is_storage_backend_location)
|
||||
and bool(location)
|
||||
and bool(location) and bool(live_progress)
|
||||
)
|
||||
auto_search_file_after_add = False
|
||||
|
||||
@@ -994,15 +1000,27 @@ class Add_File(Cmdlet):
|
||||
suffix = metadata.get("ext")
|
||||
|
||||
tmp_dir = Path(tempfile.mkdtemp(prefix="add-file-src-"))
|
||||
|
||||
# Pass suffix to downloader if it supports it
|
||||
|
||||
# Introspect downloader to pass supported args (suffix, progress_callback)
|
||||
import inspect
|
||||
|
||||
sig = inspect.signature(downloader)
|
||||
kwargs = {"temp_root": tmp_dir}
|
||||
if "suffix" in sig.parameters:
|
||||
downloaded = downloader(str(file_hash), temp_root=tmp_dir, suffix=suffix)
|
||||
else:
|
||||
downloaded = downloader(str(file_hash), temp_root=tmp_dir)
|
||||
|
||||
kwargs["suffix"] = suffix
|
||||
|
||||
# Hook into global PipelineProgress if available
|
||||
pp = PipelineProgress.get()
|
||||
if pp and "progress_callback" in sig.parameters:
|
||||
|
||||
def _cb(done, total):
|
||||
# Show fetch progress instead of just 'resolving'
|
||||
pp.update(downloaded=done, total=total, label="peer transfer")
|
||||
|
||||
kwargs["progress_callback"] = _cb
|
||||
|
||||
downloaded = downloader(str(file_hash), **kwargs)
|
||||
|
||||
if isinstance(downloaded, Path) and downloaded.exists():
|
||||
pipe_obj.is_temp = True
|
||||
return downloaded, tmp_dir
|
||||
|
||||
@@ -229,9 +229,11 @@ class Download_File(Cmdlet):
|
||||
|
||||
except Exception as e:
|
||||
log(f"Provider {provider_name} error handling {url}: {e}", file=sys.stderr)
|
||||
# Fallthrough to direct download?
|
||||
# If a provider explicitly claimed it but failed, we'll try direct download as a last resort.
|
||||
pass
|
||||
|
||||
if not handled:
|
||||
debug(f"Provider {provider_name} matched URL but failed to download. Skipping direct fallback to avoid landing pages.")
|
||||
continue
|
||||
|
||||
# Direct Download Fallback
|
||||
result_obj = _download_direct_file(
|
||||
|
||||
Reference in New Issue
Block a user