aria2-feeder: permitir especificar RPC y silenciar curl
This commit is contained in:
parent
356e763088
commit
a573b55f61
3 changed files with 9 additions and 4 deletions
|
@ -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"
|
||||
```
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue