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
+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),