From a573b55f6191e4d0b2a7cba3a3e2e9e84ad670b8 Mon Sep 17 00:00:00 2001 From: Nulo Date: Tue, 30 Nov 2021 20:45:59 -0300 Subject: [PATCH] aria2-feeder: permitir especificar RPC y silenciar curl --- aria2-feeder/README.md | 4 ++-- aria2-feeder/feed-aria2.lua | 7 ++++++- aria2-feeder/feed-aria2.sh | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/aria2-feeder/README.md b/aria2-feeder/README.md index 6e4e0d1..20f01f2 100644 --- a/aria2-feeder/README.md +++ b/aria2-feeder/README.md @@ -4,7 +4,7 @@ Le inserta urls a [aria2](https://aria2.github.io) via su interfaz JSON RPC (via ```sh # Para una URL -./feed-aria2.sh "https://URL" +./feed-aria2.sh "https://URL" "localhost:6800" # Para un archivo con una URL por lĂ­nea -lua feed-aria2.lua "archivo" +lua feed-aria2.lua "archivo" "localhost:6800" ``` diff --git a/aria2-feeder/feed-aria2.lua b/aria2-feeder/feed-aria2.lua index cdbd75e..1a519a1 100644 --- a/aria2-feeder/feed-aria2.lua +++ b/aria2-feeder/feed-aria2.lua @@ -1,10 +1,15 @@ local file = arg[1] local handle = io.open(file) +local rpc = arg[2] +if not rpc then + rpc = "localhost:6800" +end + while 1 do local line = handle:read("*l") if not line then break end - local result = os.execute("./feed-aria2.sh '"..line.."'") + local result = os.execute("./feed-aria2.sh '"..line.."' '"..rpc.."'") if not result == 0 then return end diff --git a/aria2-feeder/feed-aria2.sh b/aria2-feeder/feed-aria2.sh index 6dfa0ef..d26dff8 100755 --- a/aria2-feeder/feed-aria2.sh +++ b/aria2-feeder/feed-aria2.sh @@ -2,4 +2,4 @@ params=$(echo -n "[[\"$1\"],{\"header\":[\"accept-encoding: gzip, br\"]}]" | base64 -w0) id=$(echo "$RANDOM * $RANDOM" | bc) -curl -q "localhost:6800/jsonrpc?method=aria2.addUri&id=$id¶ms=$params" +curl -q "$2/jsonrpc?method=aria2.addUri&id=$id¶ms=$params" >/dev/null 2>/dev/null