This commit is contained in:
nose
2025-12-14 00:53:52 -08:00
parent 52a79b0086
commit a03eb0d1be
24 changed files with 2785 additions and 1868 deletions

35
CLI.py
View File

@@ -1498,6 +1498,9 @@ def _execute_pipeline(tokens: list):
elif table_type == 'soulseek':
print(f"Auto-piping Soulseek selection to download-file")
stages.append(['download-file'])
elif table_type == 'openlibrary':
print(f"Auto-piping OpenLibrary selection to download-file")
stages.append(['download-file'])
elif source_cmd == 'search-file' and source_args and 'youtube' in source_args:
# Legacy check
print(f"Auto-piping YouTube selection to .pipe")
@@ -1667,6 +1670,35 @@ def _execute_pipeline(tokens: list):
filtered_pipe_objs = [coerce_to_pipe_object(item) for item in filtered]
piped_result = filtered_pipe_objs if len(filtered_pipe_objs) > 1 else filtered_pipe_objs[0]
print(f"Selected {len(filtered)} item(s) using {cmd_name}")
# If selection is the last stage and looks like a provider result,
# auto-initiate the borrow/download flow.
if stage_index + 1 >= len(stages):
try:
from ProviderCore.registry import get_search_provider as _get_search_provider
except Exception:
_get_search_provider = None
if _get_search_provider is not None:
selected_list = filtered_pipe_objs
provider_table: Optional[str] = None
try:
for obj in selected_list:
extra = getattr(obj, "extra", None)
if isinstance(extra, dict) and extra.get("table"):
provider_table = str(extra.get("table"))
break
except Exception:
provider_table = None
if provider_table:
try:
provider = _get_search_provider(provider_table, config)
except Exception:
provider = None
if provider is not None:
print("Auto-downloading selection via download-file")
stages.append(["download-file"])
continue
else:
print(f"No items matched selection {cmd_name}\n")
@@ -1736,13 +1768,14 @@ def _execute_pipeline(tokens: list):
}
# Display-only commands (just show data, don't modify or search)
display_only_commands = {
'get-url', 'get_url', 'get-note', 'get_note',
'get-note', 'get_note',
'get-relationship', 'get_relationship', 'get-file', 'get_file',
'check-file-status', 'check_file_status'
}
# Commands that manage their own table/history state (e.g. get-tag)
self_managing_commands = {
'get-tag', 'get_tag', 'tags',
'get-url', 'get_url',
'search-file', 'search_file'
}