nautd/webui: scripting, labels, settings, set-location, pause fix
Session checkpoint on webui-plugin: - engine dump (nautctl dump) + engine endgame integration - per-file move locations persistence; torrent-level "Set location" with reset/keep-relative/leave-separate handling + residual prune - Lua: naut.get_labels, define_settings/get_setting (script_host struct) - daemon-owned labels (category+tags) + taxonomy persistence; webui write-through - fix: pausing a completed/seeding torrent now sticks (stop wins over result) - automation tab responsive layout; anime_sort label gating + settings Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
6dc711cf57
commit
b633b7d216
40 changed files with 3305 additions and 3267 deletions
|
|
@ -7,7 +7,16 @@ local ref = require("anitomy")
|
|||
|
||||
-- stub the host API the script calls, and silence its prints
|
||||
local captured
|
||||
_G.naut = { move_file = function(tid, idx, dest) captured = dest end }
|
||||
-- Per-torrent label stub: torrent 1 is labelled "anime"; others are unlabelled.
|
||||
local LABELS = { [1] = { "anime" } }
|
||||
-- Optional per-key setting overrides; nil falls back to the script's defaults.
|
||||
local SETTINGS = {}
|
||||
_G.naut = {
|
||||
move_file = function(tid, idx, dest) captured = dest end,
|
||||
get_labels = function(tid) return LABELS[tid] or {} end,
|
||||
define_settings = function(_) end, -- schema declaration: no-op here
|
||||
get_setting = function(key) return SETTINGS[key] end,
|
||||
}
|
||||
local realprint = print
|
||||
_G.print = function() end
|
||||
|
||||
|
|
@ -23,9 +32,9 @@ local configured_root = _G.anime_sort.destination({
|
|||
assert(configured_root, "could not derive SORTED_ROOT from anime_sort.lua")
|
||||
|
||||
local fails = 0
|
||||
local function fire(path)
|
||||
local function fire(path, torrent_id)
|
||||
captured = nil
|
||||
on_file_complete({ torrent_id = 1, index = 0, path = path })
|
||||
on_file_complete({ torrent_id = torrent_id or 1, index = 0, path = path })
|
||||
return captured
|
||||
end
|
||||
local function expect(path, want_dest)
|
||||
|
|
@ -69,6 +78,42 @@ do
|
|||
end
|
||||
end
|
||||
|
||||
-- label gate: a torrent without the "anime" label is left alone (no move),
|
||||
-- while an "anime"-labelled torrent is still sorted.
|
||||
do
|
||||
local episode = "/downloads/[HorribleSubs] Boku no Hero Academia - 12 [1080p].mkv"
|
||||
local unlabelled = fire(episode, 2) -- torrent 2 has no labels
|
||||
if unlabelled ~= nil then
|
||||
fails = fails + 1
|
||||
realprint("FAIL unlabelled torrent should be skipped, got: "
|
||||
.. tostring(unlabelled))
|
||||
else
|
||||
realprint("ok unlabelled torrent skipped")
|
||||
end
|
||||
local labelled = fire(episode, 1) -- torrent 1 is labelled "anime"
|
||||
if labelled == nil then
|
||||
fails = fails + 1
|
||||
realprint("FAIL anime-labelled torrent should be sorted")
|
||||
else
|
||||
realprint("ok anime-labelled torrent sorted")
|
||||
end
|
||||
end
|
||||
|
||||
-- settings: a value configured in the UI (delivered via naut.get_setting) takes
|
||||
-- effect live, without editing the script.
|
||||
do
|
||||
SETTINGS.sorted_root = "/custom/lib"
|
||||
local got = fire("/downloads/[HorribleSubs] Boku no Hero Academia - 12 [1080p].mkv", 1)
|
||||
SETTINGS.sorted_root = nil
|
||||
local want = "/custom/lib/Boku no Hero Academia/Season 01/Boku no Hero Academia - S01E12.mkv"
|
||||
if got ~= want then
|
||||
fails = fails + 1
|
||||
realprint("FAIL sorted_root override not applied, got: " .. tostring(got))
|
||||
else
|
||||
realprint("ok sorted_root setting override applied")
|
||||
end
|
||||
end
|
||||
|
||||
-- drift guard: embedded parser must agree with anitomy.lua
|
||||
local embedded = _G.anime_sort.anitomy
|
||||
local drift = 0
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue