Migrate imports to SYS package (pipeline/result_table) and update related imports
Some checks failed
smoke-mm / Install & smoke test mm --help (push) Has been cancelled

This commit is contained in:
2025-12-29 23:28:15 -08:00
parent 30d3bf480b
commit ef01ca03a0
60 changed files with 162 additions and 149 deletions

View File

@@ -27,7 +27,7 @@ import subprocess
from pathlib import Path
from typing import Any, Dict, List, Optional, Sequence, Tuple
import pipeline as ctx
from SYS import pipeline as ctx
from API import HydrusNetwork
from API.folder import read_sidecar, write_sidecar, find_sidecar, API_folder_store
from . import _shared as sh
@@ -42,7 +42,7 @@ get_field = sh.get_field
from SYS.config import get_local_storage_path
try:
from metadata import extract_title
from SYS.metadata import extract_title
except ImportError:
extract_title = None
@@ -152,7 +152,7 @@ def _resolve_candidate_urls_for_item(
) -> List[str]:
"""Get candidate URLs from backend and/or piped result."""
try:
from metadata import normalize_urls
from SYS.metadata import normalize_urls
except Exception:
normalize_urls = None # type: ignore[assignment]
@@ -328,7 +328,7 @@ def _emit_tags_as_table(
This replaces _print_tag_list to make tags pipe-able.
Stores the table in ctx._LAST_RESULT_TABLE for downstream @ selection.
"""
from result_table import ResultTable
from SYS.result_table import ResultTable
# Create ResultTable with just tag column (no title)
# Keep the title stable and avoid including hash fragments.
@@ -776,7 +776,7 @@ def _scrape_url_metadata(
import json as json_module
try:
from metadata import extract_ytdlp_tags
from SYS.metadata import extract_ytdlp_tags
except ImportError:
extract_ytdlp_tags = None
@@ -956,7 +956,7 @@ def _scrape_url_metadata(
# Deduplicate tags by namespace to prevent duplicate title:, artist:, etc.
try:
from metadata import dedup_tags_by_namespace as _dedup
from SYS.metadata import dedup_tags_by_namespace as _dedup
if _dedup:
tags = _dedup(tags, keep_first=True)
@@ -1265,7 +1265,7 @@ def _run(result: Any, args: Sequence[str], config: Dict[str, Any]) -> int:
return 1
try:
from metadata import extract_ytdlp_tags
from SYS.metadata import extract_ytdlp_tags
except Exception:
extract_ytdlp_tags = None # type: ignore[assignment]
@@ -1554,7 +1554,7 @@ def _run(result: Any, args: Sequence[str], config: Dict[str, Any]) -> int:
)
return 0
from result_table import ResultTable
from SYS.result_table import ResultTable
table = ResultTable(f"Metadata: {provider.name}")
table.set_source_command("get-tag", [])