From 04d5da1435014a14b95a5b46d7c4c342ec9cc53d Mon Sep 17 00:00:00 2001 From: Javinator9889 Date: Mon, 25 May 2020 10:53:29 +0200 Subject: [PATCH 1/2] Update manual-tracker grep behaviour According to manual page and StackOverflow, when there is a match grep returns 'SUCCESS', so the logic of the 'if' code must be inverted. In addition, for better output readability, instead of "failure" the output may be "already added" as `transmission-remote` says "Invalid argument" when a torrent has the specific tracker included --- manual-tracker-add.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manual-tracker-add.sh b/manual-tracker-add.sh index 1afe076..922a663 100755 --- a/manual-tracker-add.sh +++ b/manual-tracker-add.sh @@ -20,10 +20,10 @@ for tracker in $(curl --location -# "${base_url}") ; do echo -en "\e[0m" echo -ne "\e[93m*\e[0m ${tracker}..." if transmission-remote "$host" ${auth:+--auth="$auth"} --torrent "${torrent_hash}" -td "${tracker}" | grep -q 'success'; then - echo -e '\e[91m failed.' + echo -e '\e[92m done.' echo -en "\e[0m" else - echo -e '\e[92m done.' + echo -e '\e[93m already added.' echo -en "\e[0m" fi done From 6ef556358c412bab69e3551a7a441c7e7478e34d Mon Sep 17 00:00:00 2001 From: Javinator9889 Date: Mon, 25 May 2020 10:56:42 +0200 Subject: [PATCH 2/2] Update tracker-add-auto.sh The same behavior described in 04d5da1435014a14b95a5b46d7c4c342ec9cc53d applies here --- tracker-add-auto.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tracker-add-auto.sh b/tracker-add-auto.sh index 44c417e..683a354 100644 --- a/tracker-add-auto.sh +++ b/tracker-add-auto.sh @@ -23,9 +23,9 @@ fi for tracker in $(cat $trackerslist) ; do echo -n "${tracker}..." if transmission-remote "$host" --auth="$auth" --torrent "${torrent_hash}" -td "${tracker}" | grep -q 'success'; then - echo ' failed.' -else echo ' done.' +else + echo ' already added.' fi done done