From abb5858572a076743efff7a1d642103cc32387c8 Mon Sep 17 00:00:00 2001 From: Sergey Matveev Date: Tue, 13 Feb 2018 15:51:56 +0300 Subject: [PATCH] Example aria2c hook for downloaded torrents --- doc/integration.texi | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/doc/integration.texi b/doc/integration.texi index c27cb36..9011ed7 100644 --- a/doc/integration.texi +++ b/doc/integration.texi @@ -250,12 +250,32 @@ You can queue you files after they are completely downloaded: @verbatim % cat send-downloaded.sh #!/bin/sh -nncp-file -chunked $(( 1024 * 100 )) "$3" remote.node + +if [ "$2" -eq 0 ]; then + # This could be downloaded .torrent file itself + exit 0 +fi + +if [ "$2" -gt 1 ]; then + # This is directory downloaded with BitTorrent + wholedir="$(dirname "$3")" + name=$(basename "$wholedir") + cd "$wholedir"/.. + tartmp=$(mktemp ./finished.XXXXXX) + tar cf $tartmp "$name" + nncp-file -chunked $(( 1024 * 100 )) $tartmp remote:"$name".tar + rm $tartmp +else + nncp-file -chunked $(( 1024 * 100 )) "$3" remote: +fi % aria2c \ --on-download-complete send-downloaded.sh \ http://example.org/file.iso \ http://example.org/file.iso.asc +% aria2c \ + --on-bt-download-complete send-downloaded.sh \ + http://example.org/file.torrent @end verbatim Also you can prepare -- 2.48.1