update download plugin

This commit is contained in:
2026-07-14 17:56:54 -07:00
parent 5e71a3cf54
commit a156700e6e
6 changed files with 125 additions and 81 deletions
-24
View File
@@ -2445,30 +2445,6 @@ def coerce_to_pipe_object(
Uses hash+store canonical pattern.
"""
# Debug: Print ResultItem details if coming from search_file.py
try:
from SYS.logger import is_debug_enabled, debug
if (is_debug_enabled() and hasattr(value,
"__class__")
and value.__class__.__name__ == "ResultItem"):
debug("[ResultItem -> PipeObject conversion]")
debug(f" title={getattr(value, 'title', None)}")
debug(f" target={getattr(value, 'target', None)}")
debug(f" hash={getattr(value, 'hash', None)}")
debug(f" media_kind={getattr(value, 'media_kind', None)}")
debug(f" tag={getattr(value, 'tag', None)}")
debug(f" tag_summary={getattr(value, 'tag_summary', None)}")
debug(f" size_bytes={getattr(value, 'size_bytes', None)}")
debug(f" duration_seconds={getattr(value, 'duration_seconds', None)}")
debug(f" relationships={getattr(value, 'relationships', None)}")
debug(f" url={getattr(value, 'url', None)}")
debug(
f" full_metadata keys={list(getattr(value, 'full_metadata', {}).keys()) if hasattr(value, 'full_metadata') and value.full_metadata else []}"
)
except Exception:
pass
if isinstance(value, models.PipeObject):
return value
+13 -2
View File
@@ -199,7 +199,7 @@ class Add_File(Cmdlet):
summary=
"Ingest a local media file to a configured store or plugin destination.",
usage=
"add-file (<source> | <piped>) (-instance <store-name> | -plugin <plugin> [-instance <name|path>]) [-delete]",
"add-file (<source> | <piped>) (-instance <store-name> | -plugin <plugin> [-instance <name|path>]) [-folder <name>] [-delete]",
arg=[
CmdletArg(
name="source",
@@ -217,6 +217,11 @@ class Add_File(Cmdlet):
description="Delete file after successful upload",
alias="del",
),
CmdletArg(
name="folder",
description="Folder name override for local plugin exports.",
alias="folder-name",
),
],
detail=[
"Note: add-file ingests local files. To fetch remote sources, use download-file and pipe into add-file.",
@@ -224,6 +229,7 @@ class Add_File(Cmdlet):
" hydrus: Upload to Hydrus database with metadata tagging",
"- Plugin options (use -plugin):",
" local: Copy file to a configured local destination or direct path via -instance",
" local folder exports: use -folder <name> (or -folder-name); piped AllDebrid downloads default to their magnet folder",
" 0x0: Upload to 0x0.st for temporary hosting",
" file.io: Upload to file.io for temporary hosting",
" internetarchive: Upload to archive.org (optional tag: ia:<identifier> to upload into an existing item)",
@@ -272,6 +278,7 @@ class Add_File(Cmdlet):
source_url_arg = parsed.get("url")
plugin_name = parsed.get("plugin")
delete_after = parsed.get("delete", False)
folder_name = parsed.get("folder")
local_export_destination: Optional[str] = None
if plugin_name and not plugin_instance and location:
plugin_instance = location
@@ -700,7 +707,8 @@ class Add_File(Cmdlet):
plugin_instance,
pipe_obj,
config,
delete_after_item
delete_after_item,
folder_name=folder_name,
)
if code == 0:
successes += 1
@@ -2532,6 +2540,7 @@ class Add_File(Cmdlet):
config: Dict[str,
Any],
delete_after: bool,
folder_name: Optional[str] = None,
) -> int:
"""Handle uploading via an add-file plugin (e.g. 0x0)."""
from PluginCore.registry import (
@@ -2585,6 +2594,8 @@ class Add_File(Cmdlet):
"pipeline_progress": pipeline_progress,
}
)
if folder_name is not None and str(folder_name).strip():
upload_kwargs["folder_name"] = str(folder_name).strip()
upload_result = file_provider.upload(
str(media_path),