This commit is contained in:
nose
2025-12-16 23:23:43 -08:00
parent 9873280f0e
commit 86918f2ae2
46 changed files with 2277 additions and 1347 deletions

39
CLI.py
View File

@@ -68,7 +68,7 @@ from typing import Callable
from config import get_local_storage_path, load_config
from cmdlet.catalog import (
from cmdlet_catalog import (
import_cmd_module as _catalog_import_cmd_module,
list_cmdlet_metadata as _catalog_list_cmdlet_metadata,
list_cmdlet_names as _catalog_list_cmdlet_names,
@@ -305,8 +305,6 @@ def _get_table_title_for_command(
'add_file': 'Results',
'delete-file': 'Results',
'delete_file': 'Results',
'check-file-status': 'Status',
'check_file_status': 'Status',
'get-metadata': None,
'get_metadata': None,
}
@@ -843,10 +841,6 @@ def _create_cmdlet_cli():
# Load config
config = _load_cli_config()
# Initialize cookies check for yt-dlp
from hydrus_health_check import initialize_cookies_check
initialize_cookies_check(config, emit_debug=False)
# Initialize debug logging if enabled
if config:
from SYS.logger import set_debug
@@ -991,8 +985,6 @@ def _create_cmdlet_cli():
# Run startup checks and render table
try:
from hydrus_health_check import initialize_cookies_check
# MPV availability is validated by MPV.MPV.__init__.
try:
from MPV.mpv_ipc import MPV
@@ -1294,8 +1286,13 @@ def _create_cmdlet_cli():
# Cookies are used by yt-dlp; keep this centralized utility.
try:
ok, detail = initialize_cookies_check(config, emit_debug=False)
_add_startup_check("FOUND" if ok else "MISSING", "Cookies", "N/A", detail or "Not found")
from tool.ytdlp import YtDlpTool
cookiefile = YtDlpTool(config).resolve_cookiefile()
if cookiefile is not None:
_add_startup_check("FOUND", "Cookies", "N/A", str(cookiefile))
else:
_add_startup_check("MISSING", "Cookies", "N/A", "Not found")
except Exception as exc:
_add_startup_check("ERROR", "Cookies", "N/A", str(exc))
@@ -1580,10 +1577,11 @@ def _execute_pipeline(tokens: list):
hash_val = getattr(item, 'hash', getattr(item, 'hash_hex', 'N/A'))
title_val = getattr(item, 'title', 'N/A')
if hash_val != 'N/A':
hash_display = hash_val[:8] + '...' if len(str(hash_val)) > 8 else hash_val
print(f" -> hash={hash_display}, title={title_val}")
hash_display = str(hash_val)
title_display = str(title_val)
print(f" -> hash:{hash_display}, title:{title_display}")
else:
print(f" -> title={title_val}")
print(f" -> title:{title_val}")
else:
print(" -> [source_index out of range]")
if resolved_list is not None:
@@ -2143,14 +2141,14 @@ def _execute_pipeline(tokens: list):
display_only_commands = {
'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',
'search-provider', 'search_provider'
'search-provider', 'search_provider',
'search-store', 'search_store'
}
overlay_table = ctx.get_display_table() if hasattr(ctx, 'get_display_table') else None
@@ -2382,7 +2380,7 @@ def _execute_cmdlet(cmd_name: str, args: list):
# Ensure native commands (cmdnat) are loaded
try:
from cmdlet.catalog import ensure_registry_loaded as _ensure_registry_loaded
from cmdlet_catalog import ensure_registry_loaded as _ensure_registry_loaded
_ensure_registry_loaded()
except Exception:
pass
@@ -2391,7 +2389,7 @@ def _execute_cmdlet(cmd_name: str, args: list):
cmd_fn = REGISTRY.get(cmd_name)
if not cmd_fn:
# Attempt lazy import of the module and retry
from cmdlet.catalog import import_cmd_module as _catalog_import
from cmdlet_catalog import import_cmd_module as _catalog_import
try:
mod = _catalog_import(cmd_name)
data = getattr(mod, "CMDLET", None) if mod else None
@@ -2537,13 +2535,13 @@ def _execute_cmdlet(cmd_name: str, args: list):
display_only_commands = {
'get-url', 'get_url', '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',
'search-file', 'search_file',
'search-provider', 'search_provider'
'search-provider', 'search_provider',
'search-store', 'search_store'
}
if cmd_name in self_managing_commands:
@@ -2596,7 +2594,6 @@ def _execute_cmdlet(cmd_name: str, args: list):
display_only_commands = {
'get-url', 'get_url', 'get-note', 'get_note',
'get-relationship', 'get_relationship', 'get-file', 'get_file',
'check-file-status', 'check_file_status'
}
self_managing_commands = {
'get-tag', 'get_tag', 'tags',