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
|
|
@ -17,6 +17,7 @@ static void usage(const char *program) {
|
|||
" add SOURCE OUTPUT [IP:PORT ...]\n"
|
||||
" list\n"
|
||||
" show TORRENT_ID\n"
|
||||
" dump TORRENT_ID\n"
|
||||
" remove TORRENT_ID\n"
|
||||
" script PATH | unscript\n"
|
||||
" status | events | shutdown\n"
|
||||
|
|
@ -93,6 +94,7 @@ int main(int argc, char **argv) {
|
|||
return stream_events(socket_path);
|
||||
|
||||
json_t *params = NULL;
|
||||
bool raw_dump = false;
|
||||
if (strcmp(method, "add") == 0) {
|
||||
if (arg + 1 >= argc) { usage(argv[0]); return 2; }
|
||||
method = "add_torrent";
|
||||
|
|
@ -113,14 +115,16 @@ int main(int argc, char **argv) {
|
|||
method = "torrents";
|
||||
params = json_object();
|
||||
} else if (strcmp(method, "show") == 0 ||
|
||||
strcmp(method, "dump") == 0 ||
|
||||
strcmp(method, "remove") == 0) {
|
||||
json_int_t id;
|
||||
if (arg + 1 != argc || !parse_id(argv[arg], &id)) {
|
||||
usage(argv[0]);
|
||||
return 2;
|
||||
}
|
||||
method = strcmp(method, "show") == 0 ? "torrent" :
|
||||
"remove_torrent";
|
||||
if (strcmp(method, "show") == 0) method = "torrent";
|
||||
else if (strcmp(method, "dump") == 0) { method = "dump_torrent"; raw_dump = true; }
|
||||
else method = "remove_torrent";
|
||||
params = json_pack("{s:I}", "torrent_id", id);
|
||||
} else if (strcmp(method, "script") == 0) {
|
||||
if (arg + 1 != argc) { usage(argv[0]); return 2; }
|
||||
|
|
@ -145,8 +149,19 @@ int main(int argc, char **argv) {
|
|||
fprintf(stderr, "nautctl: RPC failed: %s\n", naut_strerror(error));
|
||||
return 1;
|
||||
}
|
||||
int result = print_json(reply);
|
||||
bool ok = json_is_true(json_object_get(reply, "ok"));
|
||||
int result;
|
||||
/* `dump` returns a multi-line text blob; print it raw instead of escaped JSON. */
|
||||
const char *dump = raw_dump
|
||||
? json_string_value(json_object_get(
|
||||
json_object_get(reply, "result"), "dump"))
|
||||
: NULL;
|
||||
if (dump) {
|
||||
fputs(dump, stdout);
|
||||
result = 0;
|
||||
} else {
|
||||
result = print_json(reply);
|
||||
}
|
||||
json_decref(reply);
|
||||
return result || !ok;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue