File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change 11#! /bin/bash
2- # Get transmission credentials
3- auth=${TRANSMISSION_USER:- user} :${TRANSMISSION_PASS:- password}
2+ # Get transmission credentials, if set
3+ if [[ -n " $TRANSMISSION_USER " && -n " $TRANSMISSION_PASS " ]]; then
4+ auth=" ${TRANSMISSION_USER:- user} :${TRANSMISSION_PASS:- password} "
5+ else
6+ auth=
7+ fi
48host=${TRANSMISSION_HOST:- localhost}
59list_url=${TRACKER_URL:- https:// raw.githubusercontent.com/ ngosang/ trackerslist/ master/ trackers_all.txt}
610
@@ -15,7 +19,7 @@ add_trackers () {
1519for tracker in $( curl --location -# " ${base_url} " ) ; do
1620 echo -en " \e[0m"
1721 echo -ne " \e[93m*\e[0m ${tracker} ..."
18- if transmission-remote " $host " --auth=" $auth " --torrent " ${torrent_hash} " -td " ${tracker} " | grep -q ' success' ; then
22+ if transmission-remote " $host " ${auth : + --auth=" $auth " } --torrent " ${torrent_hash} " -td " ${tracker} " | grep -q ' success' ; then
1923 echo -e ' \e[91m failed.'
2024 echo -en " \e[0m"
2125else
2731}
2832
2933# Get list of active torrents
30- ids=${1:- " $( transmission-remote " $host " --auth=" $auth " --list | grep -vE ' Seeding|Stopped|Finished' | grep ' ^ ' | awk ' { print $1 }' ) " }
34+ ids=${1:- " $( transmission-remote " $host " ${auth : + --auth=" $auth " } --list | grep -vE ' Seeding|Stopped|Finished' | grep ' ^ ' | awk ' { print $1 }' ) " }
3135
3236for id in $ids ; do
33- hash=" $( transmission-remote " $host " --auth=" $auth " --torrent " $id " --info | grep ' ^ Hash: ' | awk ' { print $2 }' ) "
34- torrent_name=" $( transmission-remote " $host " --auth=" $auth " --torrent " $id " --info | grep ' ^ Name: ' | cut -c 9-) "
37+ hash=" $( transmission-remote " $host " ${auth : + --auth=" $auth " } --torrent " $id " --info | grep ' ^ Hash: ' | awk ' { print $2 }' ) "
38+ torrent_name=" $( transmission-remote " $host " ${auth : + --auth=" $auth " } --torrent " $id " --info | grep ' ^ Name: ' | cut -c 9-) "
3539 add_trackers " $hash "
3640done
You can’t perform that action at this time.
0 commit comments