Skip to content

Commit 5392ec2

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 9af60af commit 5392ec2

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
@@ -6,9 +6,17 @@ add_trackers () {
66
torrent_hash=$1
77
id=$2
88
for base_url in "$TORRENTLIST" ; do
9+
if [ ! -f /tmp/trackers.txt ]; then
10+
curl -o "/tmp/trackers.txt" "${base_url}"
11+
fi
12+
Local=$(wc -c < /tmp/trackers.txt)
13+
Remote=$(curl -sI "${base_url}" | awk '/Content-Length/ {sub("\r",""); print $2}')
14+
if [ $Local != $Remote ]; then
15+
curl -o "/tmp/trackers.txt" "${base_url}"
16+
fi
917
echo "URL for ${base_url}"
1018
echo "Adding trackers for $torrent_name..."
11-
for tracker in $(curl -# "${base_url}") ; do
19+
for tracker in $(cat /tmp/trackers.txt) ; do
1220
echo -n "${tracker}..."
1321
if transmission-remote "$HOSTPORT" --authenv --torrent "${torrent_hash}" -td "${tracker}" | grep -q 'success'; then
1422
echo ' failed.'
@@ -21,7 +29,7 @@ done
2129
rm -f /tmp/TTAA.$id.lock
2230
}
2331
# Get list of active torrents
24-
ids="$(transmission-remote "$HOSTPORT" --authenv --list | grep -vE 'Seeding|Stopped|Finished' | grep '^ ' | awk '{ print $1 }')"
32+
ids="$(transmission-remote "$HOSTPORT" --authenv --list | grep -vE 'Seeding|Stopped|Finished|[[:space:]]100%[[:space:]]' | grep '^ ' | awk '{ print $1 }')"
2533
for id in $ids ; do
2634
add_date="$(transmission-remote "$HOSTPORT" --authenv --torrent "$id" --info| grep '^ Date added: ' |cut -c 21-)"
2735
add_date_t="$(date -d "$add_date" "+%Y-%m-%d %H:%M")"

0 commit comments

Comments
 (0)