webui: replace nautctl web server with a loadable plugin
Drop the web UI that was compiled into nautctl and serve the torrent-ui front end (../torrent-ui/public) from a native plugin (plugins/webui) loaded via `nautd --plugin`. The plugin talks to the engine only through the host call_rpc ABI and adapts the daemon's RPC surface to the qBittorrent-style contract the UI expects (snapshot/SSE, torrent detail tabs, add/delete, cookie auth). Also folds in the daemon refactor that owns per-torrent worker threads and the swarm engine (naut_swarm) used by the plugin's data source. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
50a357968a
commit
8dde48c05a
27 changed files with 2706 additions and 403 deletions
|
|
@ -18,13 +18,10 @@ Movies (no detectable episode) go to `<SORTED_ROOT>/<Title>/<Title> (year).<ext>
|
|||
### Use it
|
||||
|
||||
```sh
|
||||
# 1. edit SORTED_ROOT (and options) at the top of the script
|
||||
# 2. start the daemon with the script
|
||||
nautd --socket /tmp/nautd.sock --script examples/anime_sort.lua
|
||||
|
||||
# 3. register each torrent's storage so the move can resolve + relocate its files
|
||||
nautctl --socket /tmp/nautd.sock add_torrent \
|
||||
'{"torrent_id":1,"torrent":"show.torrent","root":"/downloads/1"}'
|
||||
# Start the engine, load the script, and add a download.
|
||||
nautd --socket /tmp/nautd.sock
|
||||
nautctl --socket /tmp/nautd.sock script examples/anime_sort.lua
|
||||
nautctl --socket /tmp/nautd.sock add show.torrent /downloads/1
|
||||
```
|
||||
|
||||
As each file completes you'll see, e.g.:
|
||||
|
|
|
|||
|
|
@ -10,9 +10,9 @@
|
|||
-- without waiting for the rest of the torrent.
|
||||
--
|
||||
-- Install:
|
||||
-- nautd --socket /tmp/nautd.sock --script examples/anime_sort.lua
|
||||
-- nautctl --socket /tmp/nautd.sock add_torrent \
|
||||
-- '{"torrent_id":1,"torrent":"show.torrent","root":"/downloads/1"}'
|
||||
-- nautd --socket /tmp/nautd.sock
|
||||
-- nautctl --socket /tmp/nautd.sock script examples/anime_sort.lua
|
||||
-- nautctl --socket /tmp/nautd.sock add show.torrent /downloads/1
|
||||
--
|
||||
-- The parser below is a VERBATIM COPY of examples/anitomy.lua (the sandbox has
|
||||
-- no `require`, so it must be inlined). Keep the two in sync; examples/
|
||||
|
|
@ -22,7 +22,7 @@
|
|||
-- CONFIG — edit these
|
||||
----------------------------------------------------------------------
|
||||
|
||||
local SORTED_ROOT = "/sorted" -- destination library root
|
||||
local SORTED_ROOT = "/workspaces/source/ai-garbo/Naut-Torrent/sorted" -- destination library root
|
||||
local ONLY_VIDEO = true -- skip non-video files (subs, nfo, samples)
|
||||
local KEEP_ORIGINAL_NAME = false -- true: keep the original filename;
|
||||
-- false: rename to "Title - SNNENN.ext"
|
||||
|
|
|
|||
|
|
@ -15,6 +15,13 @@ dofile(dir .. "anime_sort.lua") -- defines on_file_complete + _G.anime_sort
|
|||
|
||||
_G.print = realprint
|
||||
|
||||
local configured_root = _G.anime_sort.destination({
|
||||
title = "__ROOT_PROBE__",
|
||||
file_name = "__ROOT_PROBE__.mkv",
|
||||
extension = "mkv",
|
||||
}):match("^(.*)/__ROOT_PROBE__/__ROOT_PROBE__%.mkv$")
|
||||
assert(configured_root, "could not derive SORTED_ROOT from anime_sort.lua")
|
||||
|
||||
local fails = 0
|
||||
local function fire(path)
|
||||
captured = nil
|
||||
|
|
@ -35,21 +42,21 @@ end
|
|||
|
||||
-- episodes
|
||||
expect("/downloads/1/[HorribleSubs] Boku no Hero Academia - 12 [1080p].mkv",
|
||||
"/sorted/Boku no Hero Academia/Season 01/Boku no Hero Academia - S01E12.mkv")
|
||||
configured_root .. "/Boku no Hero Academia/Season 01/Boku no Hero Academia - S01E12.mkv")
|
||||
expect("/downloads/2/[Group] Attack on Titan S04E28 [BD 1080p HEVC].mkv",
|
||||
"/sorted/Attack on Titan/Season 04/Attack on Titan - S04E28.mkv")
|
||||
configured_root .. "/Attack on Titan/Season 04/Attack on Titan - S04E28.mkv")
|
||||
expect("/dl/[Commie] Steins;Gate 0 - 12 [BD 1080p].mkv",
|
||||
"/sorted/Steins;Gate 0/Season 01/Steins;Gate 0 - S01E12.mkv")
|
||||
configured_root .. "/Steins;Gate 0/Season 01/Steins;Gate 0 - S01E12.mkv")
|
||||
expect("Demon.Slayer.Kimetsu.no.Yaiba.S03E11.1080p.mkv",
|
||||
"/sorted/Demon Slayer Kimetsu no Yaiba/Season 03/Demon Slayer Kimetsu no Yaiba - S03E11.mkv")
|
||||
configured_root .. "/Demon Slayer Kimetsu no Yaiba/Season 03/Demon Slayer Kimetsu no Yaiba - S03E11.mkv")
|
||||
expect("/x/[Erai-raws] Jujutsu Kaisen 2nd Season - 17 [1080p].mkv",
|
||||
"/sorted/Jujutsu Kaisen/Season 02/Jujutsu Kaisen - S02E17.mkv")
|
||||
configured_root .. "/Jujutsu Kaisen/Season 02/Jujutsu Kaisen - S02E17.mkv")
|
||||
|
||||
-- movies (no episode)
|
||||
expect("/m/[Group] A Silent Voice [BD 1080p FLAC].mkv",
|
||||
"/sorted/A Silent Voice/A Silent Voice.mkv")
|
||||
configured_root .. "/A Silent Voice/A Silent Voice.mkv")
|
||||
expect("/m/Spirited.Away.2001.1080p.BluRay.x264.mkv",
|
||||
"/sorted/Spirited Away/Spirited Away (2001).mkv")
|
||||
configured_root .. "/Spirited Away/Spirited Away (2001).mkv")
|
||||
|
||||
-- non-video file must be skipped (no move queued)
|
||||
do
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue