File tree Expand file tree Collapse file tree 2 files changed +42
-2
lines changed Expand file tree Collapse file tree 2 files changed +42
-2
lines changed Original file line number Diff line number Diff line change
1
+ #! /bin/bash
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
8
+ host=${TRANSMISSION_HOST:- localhost}
9
+ list_url=${TRACKER_URL:-/ data/ source/ trackerslist/ trackers_acg.txt}
10
+
11
+ add_trackers () {
12
+ torrent_hash=$1
13
+ for base_url in " ${list_url} " ; do
14
+ echo -e " \e[1m\e[5m"
15
+ echo " URL for ${base_url} "
16
+ echo -e " Adding trackers for \e[91m$torrent_name ..."
17
+ echo -en " \e[0m"
18
+ echo -e " \e[2m\e[92m"
19
+ for tracker in $( cat " ${base_url} " ) ; do
20
+ echo -en " \e[0m"
21
+ echo -ne " \e[93m*\e[0m ${tracker} ..."
22
+ if transmission-remote " $host " ${auth: +--auth=" $auth " } --torrent " ${torrent_hash} " -td " ${tracker} " | grep -q ' success' ; then
23
+ echo -e ' \e[92m done.'
24
+ echo -en " \e[0m"
25
+ else
26
+ echo -e ' \e[93m already added.'
27
+ echo -en " \e[0m"
28
+ fi
29
+ done
30
+ done
31
+ }
32
+
33
+ # Get list of active torrents
34
+ ids=${1:- " $( transmission-remote " $host " ${auth: +--auth=" $auth " } --list | grep -vE ' Seeding|Stopped|Finished' | grep ' ^ ' | awk ' { print $1 }' ) " }
35
+
36
+ for id in $ids ; do
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-) "
39
+ add_trackers " $hash "
40
+ done
Original file line number Diff line number Diff line change 6
6
auth=
7
7
fi
8
8
host=${TRANSMISSION_HOST:- localhost}
9
- list_url=${TRACKER_URL:- https :// raw.githubusercontent.com / ngosang / trackerslist/ master / trackers_all.txt}
9
+ list_url=${TRACKER_URL:-/ data / source / trackerslist/ trackers_all.txt}
10
10
11
11
add_trackers () {
12
12
torrent_hash=$1
@@ -16,7 +16,7 @@ add_trackers () {
16
16
echo -e " Adding trackers for \e[91m$torrent_name ..."
17
17
echo -en " \e[0m"
18
18
echo -e " \e[2m\e[92m"
19
- for tracker in $( curl --location -# " ${base_url} " ) ; do
19
+ for tracker in $( cat " ${base_url} " ) ; do
20
20
echo -en " \e[0m"
21
21
echo -ne " \e[93m*\e[0m ${tracker} ..."
22
22
if transmission-remote " $host " ${auth: +--auth=" $auth " } --torrent " ${torrent_hash} " -td " ${tracker} " | grep -q ' success' ; then
You can’t perform that action at this time.
0 commit comments