update and cleanup repo

This commit is contained in:
2026-05-26 15:32:01 -07:00
parent 5041d9fbb9
commit 0db899d0c3
72 changed files with 788 additions and 1884 deletions
+22 -23
View File
@@ -17,7 +17,7 @@ from SYS.result_publication import overlay_existing_result_table, publish_result
from SYS.rich_display import show_available_plugins_panel, show_plugin_config_panel
from SYS.utils_constant import ALL_SUPPORTED_EXTENSIONS
from PluginCore.backend_registry import BackendRegistry
from API.HTTP import _download_direct_file
from API.HTTP import download_direct_file
from .. import _shared as sh
Cmdlet = sh.Cmdlet
@@ -31,7 +31,7 @@ merge_sequences = sh.merge_sequences
extract_relationships = sh.extract_relationships
extract_duration = sh.extract_duration
coerce_to_pipe_object = sh.coerce_to_pipe_object
collapse_namespace_tag = sh.collapse_namespace_tag
collapse_namespace_tags = sh.collapse_namespace_tags
resolve_target_dir = sh.resolve_target_dir
resolve_media_kind_by_extension = sh.resolve_media_kind_by_extension
coerce_to_path = sh.coerce_to_path
@@ -102,10 +102,10 @@ def _maybe_apply_florencevision_tags(
config: Dict[str, Any],
pipe_obj: Optional[models.PipeObject] = None,
) -> List[str]:
"""Optionally auto-tag images using the FlorenceVision tool.
"""Optionally auto-tag images using the FlorenceVision plugin helper.
Controlled via config:
[tool=florencevision]
[plugin=florencevision]
enabled=true
strict=false
@@ -114,8 +114,8 @@ def _maybe_apply_florencevision_tags(
"""
strict = False
try:
tool_block = (config or {}).get("tool")
fv_block = tool_block.get("florencevision") if isinstance(tool_block, dict) else None
plugin_block = (config or {}).get("plugin")
fv_block = plugin_block.get("florencevision") if isinstance(plugin_block, dict) else None
enabled = False
if isinstance(fv_block, dict):
enabled = bool(fv_block.get("enabled"))
@@ -123,7 +123,7 @@ def _maybe_apply_florencevision_tags(
if not enabled:
return tags
from tool.florencevision import FlorenceVisionTool
from plugins.florencevision import FlorenceVisionTool
# Special-case: if this file was produced by the `screen-shot` cmdlet,
# OCR is more useful than caption/detection for tagging screenshots.
@@ -134,12 +134,12 @@ def _maybe_apply_florencevision_tags(
if action.lower().startswith("cmdlet:"):
cmdlet_name = action.split(":", 1)[1].strip().lower()
if cmdlet_name in {"screen-shot", "screen_shot", "screenshot"}:
tool_block2 = dict((config or {}).get("tool") or {})
fv_block2 = dict(tool_block2.get("florencevision") or {})
plugin_block2 = dict((config or {}).get("plugin") or {})
fv_block2 = dict(plugin_block2.get("florencevision") or {})
fv_block2["task"] = "ocr"
tool_block2["florencevision"] = fv_block2
plugin_block2["florencevision"] = fv_block2
cfg_for_tool = dict(config or {})
cfg_for_tool["tool"] = tool_block2
cfg_for_tool["plugin"] = plugin_block2
except Exception:
cfg_for_tool = config
@@ -1237,7 +1237,7 @@ class Add_File(Cmdlet):
except Exception:
pass
downloaded = _download_direct_file(
downloaded = download_direct_file(
url_text,
download_root,
quiet=False,
@@ -1693,9 +1693,8 @@ class Add_File(Cmdlet):
) -> Tuple[Optional[Path], Optional[str], Optional[Path]]:
plugin_key = None
for source in (
pipe_obj.provider,
pipe_obj.plugin,
get_field(result, "plugin"),
get_field(result, "provider"),
get_field(result, "table"),
):
candidate = Add_File._normalize_provider_key(source)
@@ -1760,7 +1759,7 @@ class Add_File(Cmdlet):
str(r_hash),
source_url,
)
downloaded = _download_direct_file(
downloaded = download_direct_file(
source_url,
download_dir,
quiet=True,
@@ -2028,7 +2027,7 @@ class Add_File(Cmdlet):
*,
hash_value: str,
store: str,
provider: Optional[str] = None,
plugin: Optional[str] = None,
path: Optional[str],
tag: List[str],
title: Optional[str],
@@ -2037,7 +2036,7 @@ class Add_File(Cmdlet):
) -> None:
pipe_obj.hash = hash_value
pipe_obj.store = store
pipe_obj.provider = provider
pipe_obj.plugin = plugin
pipe_obj.is_temp = False
pipe_obj.path = path
pipe_obj.tag = tag
@@ -2260,7 +2259,7 @@ class Add_File(Cmdlet):
t for t in tags_from_result
if not str(t).strip().lower().startswith("title:")
]
sidecar_tags = collapse_namespace_tag(
sidecar_tags = collapse_namespace_tags(
[normalize_title_tag(t) for t in sidecar_tags],
"title",
prefer="last"
@@ -2449,15 +2448,15 @@ class Add_File(Cmdlet):
or "unknown"
).strip() or "unknown"
store_value = str(payload.get("store") or "").strip()
provider_value = payload.get("provider")
if provider_value is None and plugin_name:
provider_value = plugin_name
plugin_value = payload.get("plugin")
if plugin_value is None and plugin_name:
plugin_value = plugin_name
Add_File._update_pipe_object_destination(
pipe_obj,
hash_value=hash_value,
store=store_value,
provider=str(provider_value) if provider_value else None,
plugin=str(plugin_value) if plugin_value else None,
path=path_value,
tag=tag_values,
title=title_value,
@@ -2584,7 +2583,7 @@ class Add_File(Cmdlet):
pipe_obj,
hash_value=f_hash or "unknown",
store="",
provider=plugin_name or None,
plugin=plugin_name or None,
path=file_path,
tag=pipe_obj.tag,
title=pipe_obj.title or (media_path.name if media_path else None),