Skip to content

Commit fd9d854

Browse files
Update tracker-add-auto.sh
now tracker file saved in tmp directory until update new exception in "Get list of active torrents"
1 parent e92b781 commit fd9d854

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

tracker-add-auto.sh

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,17 @@ add_trackers () {
99
torrent_hash=$1
1010
id=$2
1111
for base_url in https://raw.githubusercontent.com/ngosang/trackerslist/master/trackers_all.txt ; do
12+
if [ ! -f /tmp/trackers.txt ]; then
13+
curl -o "/tmp/trackers.txt" "${base_url}"
14+
fi
15+
Local=$(wc -c < /tmp/trackers.txt)
16+
Remote=$(curl -sI "${base_url}" | awk '/Content-Length/ {sub("\r",""); print $2}')
17+
if [ $Local != $Remote ]; then
18+
curl -o "/tmp/trackers.txt" "${base_url}"
19+
fi
1220
echo "URL for ${base_url}"
1321
echo "Adding trackers for $torrent_name..."
14-
for tracker in $(curl -# "${base_url}") ; do
22+
for tracker in $(cat /tmp/trackers.txt) ; do
1523
echo -n "${tracker}..."
1624
if transmission-remote "$host" --auth="$auth" --torrent "${torrent_hash}" -td "${tracker}" | grep -q 'success'; then
1725
echo ' failed.'
@@ -24,7 +32,7 @@ done
2432
rm -f /tmp/TTAA.$id.lock
2533
}
2634
# Get list of active torrents
27-
ids="$(transmission-remote "$host" --auth="$auth" --list | grep -vE 'Seeding|Stopped|Finished' | grep '^ ' | awk '{ print $1 }')"
35+
ids="$(transmission-remote "$host" --auth="$auth" --list | grep -vE 'Seeding|Stopped|Finished|[[:space:]]100%[[:space:]]' | grep '^ ' | awk '{ print $1 }')"
2836
for id in $ids ; do
2937
add_date="$(transmission-remote "$host" --auth="$auth" --torrent "$id" --info| grep '^ Date added: ' |cut -c 21-)"
3038
add_date_t="$(date -d "$add_date" "+%Y-%m-%d %H:%M")"

0 commit comments

Comments
 (0)