This commit is contained in:
2026-02-14 20:39:33 -08:00
parent ae4880b164
commit 14871a1f02
3 changed files with 63 additions and 10 deletions

View File

@@ -1329,7 +1329,11 @@ class PipelineExecutor:
# This executor is used by both the REPL and the `pipeline` subcommand.
# Quiet/background mode is helpful for detached/background runners, but
# it suppresses interactive UX (like the pipeline Live progress UI).
config["_quiet_background_output"] = bool(self._toolbar_output is None)
try:
is_tty = bool(getattr(sys.stderr, "isatty", lambda: False)())
except Exception:
is_tty = False
config["_quiet_background_output"] = not is_tty
return config
@staticmethod
@@ -2195,6 +2199,37 @@ class PipelineExecutor:
logger.exception("Failed to record pipeline log step for applied row action (pipeline_session=%r)", getattr(pipeline_session, 'worker_id', None))
else:
first_cmd = stages[0][0] if stages and stages[0] else None
first_cmd_norm = _norm_cmd(first_cmd)
inserted_provider_download = False
if first_cmd_norm == "add-file":
# If selected rows advertise an explicit download-file action,
# run download before add-file so add-file receives local files.
if len(selection_indices) == 1:
row_action = _get_row_action(selection_indices[0], items_list)
if row_action and _norm_cmd(row_action[0]) == "download-file":
stages.insert(0, [str(x) for x in row_action if x is not None])
inserted_provider_download = True
debug("Auto-inserting row download-file action before add-file")
# Multi-selection fallback: if any selected row declares a
# download-file action, insert a generic download-file stage.
# This keeps provider-specific behavior in provider metadata.
if (not inserted_provider_download) and len(selection_indices) > 1:
try:
has_download_row_action = False
for idx in selection_indices:
row_action = _get_row_action(idx, items_list)
if row_action and _norm_cmd(row_action[0]) == "download-file":
has_download_row_action = True
break
if has_download_row_action:
stages.insert(0, ["download-file"])
inserted_provider_download = True
debug("Auto-inserting download-file before add-file for provider selection")
except Exception:
pass
if isinstance(table_type, str) and table_type.startswith("metadata.") and first_cmd not in (
"get-tag",
"get_tag",
@@ -2204,7 +2239,7 @@ class PipelineExecutor:
print("Auto-inserting get-tag after metadata selection")
stages.insert(0, ["get-tag"])
elif auto_stage:
first_cmd_norm = _norm_cmd(first_cmd)
first_cmd_norm = _norm_cmd(stages[0][0] if stages and stages[0] else None)
auto_cmd_norm = _norm_cmd(auto_stage[0])
if first_cmd_norm not in (auto_cmd_norm, ".pipe", ".mpv"):
debug(f"Auto-inserting {auto_cmd_norm} after selection")