romarr-mcp: import_path, adopt a file with an explicit platform
NixOS Configuration CI / Nix Flake Check (pull_request) Successful in 19s
NixOS Configuration CI / Nix Flake Check (pull_request) Successful in 19s
This commit is contained in:
1 parent
2393f594b3
commit
361683fc2b
1 file changed
+27
@@ -226,6 +226,25 @@ def t_manual_scan(a):
|
|||||||
return get("/api/v1/manualimport", path=a["path"], platform=a.get("platform"))
|
return get("/api/v1/manualimport", path=a["path"], platform=a.get("platform"))
|
||||||
|
|
||||||
|
|
||||||
|
def t_import_path(a):
|
||||||
|
"""Adopt one file or directory with an explicit platform, bypassing the queue.
|
||||||
|
|
||||||
|
`POST /api/v1/manualimport` is the action half of Manual Import: the
|
||||||
|
platform given here wins over the header guess, which is the whole point --
|
||||||
|
an ISO9660 PS2 disc reports itself as psx, so a guess cannot be trusted.
|
||||||
|
"""
|
||||||
|
path = (a.get("path") or "").strip()
|
||||||
|
platform = (a.get("platform") or "").strip()
|
||||||
|
if not path:
|
||||||
|
raise ToolError("path is required (a file or directory on ROMarr's host)")
|
||||||
|
if not platform:
|
||||||
|
raise ToolError("platform is required (e.g. ps2) -- the header guess is unreliable")
|
||||||
|
body = {"path": path, "platform": platform}
|
||||||
|
if a.get("force"):
|
||||||
|
body["force"] = True
|
||||||
|
return post("/api/v1/manualimport", body)
|
||||||
|
|
||||||
|
|
||||||
def _obj(props, required=None):
|
def _obj(props, required=None):
|
||||||
return {
|
return {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
@@ -403,6 +422,14 @@ TOOLS = [
|
|||||||
"write": True,
|
"write": True,
|
||||||
"fn": t_import_finished,
|
"fn": t_import_finished,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "import_path",
|
||||||
|
"description": "Adopt a file or folder into the library with an explicit platform, bypassing queue matching. Use when a finished download never imported.",
|
||||||
|
"schema": _obj({"path": {"type": "string"}, "platform": P_PLATFORM,
|
||||||
|
"force": {"type": "boolean"}}, ["path", "platform"]),
|
||||||
|
"write": True,
|
||||||
|
"fn": t_import_path,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "manual_scan",
|
"name": "manual_scan",
|
||||||
"description": "Scan a directory on ROMarr's host for files it could adopt, without importing them.",
|
"description": "Scan a directory on ROMarr's host for files it could adopt, without importing them.",
|
||||||
|
|||||||
Reference in new issue
Block a user