This commit is contained in:
2026-01-14 21:53:07 -08:00
parent 4b324b1e8e
commit 5d63777dee
5 changed files with 146 additions and 116 deletions

View File

@@ -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