Skip to content

Commit a805823

Browse files
committed
add local file
1 parent 0a33869 commit a805823

File tree

2 files changed

+42
-2
lines changed

2 files changed

+42
-2
lines changed

manual-tracker-acg-add.sh

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
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

manual-tracker-add.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ else
66
auth=
77
fi
88
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}
1010

1111
add_trackers () {
1212
torrent_hash=$1
@@ -16,7 +16,7 @@ add_trackers () {
1616
echo -e "Adding trackers for \e[91m$torrent_name..."
1717
echo -en "\e[0m"
1818
echo -e "\e[2m\e[92m"
19-
for tracker in $(curl --location -# "${base_url}") ; do
19+
for tracker in $(cat "${base_url}") ; do
2020
echo -en "\e[0m"
2121
echo -ne "\e[93m*\e[0m ${tracker}..."
2222
if transmission-remote "$host" ${auth:+--auth="$auth"} --torrent "${torrent_hash}" -td "${tracker}" | grep -q 'success'; then

0 commit comments

Comments
 (0)