Skip to content

Commit d074659

Browse files
Update tracker-add-auto.sh
add feature connection to host
1 parent 432e2c6 commit d074659

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

tracker-add-auto.sh

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/bin/bash
2-
# Get transmission credentials
2+
# Get transmission credentials and ip or dns ardress
33
auth=user:password
4+
host=localhost
45
while true ; do
56
sleep 25
67
add_trackers () {
@@ -11,7 +12,7 @@ for base_url in https://raw.githubusercontent.com/ngosang/trackerslist/master/tr
1112
echo "Adding trackers for $torrent_name..."
1213
for tracker in $(curl -# "${base_url}") ; do
1314
echo -n "${tracker}..."
14-
if transmission-remote --auth="$auth" --torrent "${torrent_hash}" -td "${tracker}" | grep -q 'success'; then
15+
if transmission-remote "$host" --auth="$auth" --torrent "${torrent_hash}" -td "${tracker}" | grep -q 'success'; then
1516
echo ' failed.'
1617
else
1718
echo ' done.'
@@ -22,17 +23,17 @@ done
2223
rm -f /tmp/TTAA.$id.lock
2324
}
2425
# Get list of active torrents
25-
ids="$(transmission-remote --auth="$auth" --list | grep -vE 'Seeding|Stopped|Finished' | grep '^ ' | awk '{ print $1 }')"
26+
ids="$(transmission-remote "$host" --auth="$auth" --list | grep -vE 'Seeding|Stopped|Finished' | grep '^ ' | awk '{ print $1 }')"
2627
for id in $ids ; do
27-
add_date="$(transmission-remote --auth="$auth" --torrent "$id" --info| grep '^ Date added: ' |cut -c 21-)"
28+
add_date="$(transmission-remote "$host" --auth="$auth" --torrent "$id" --info| grep '^ Date added: ' |cut -c 21-)"
2829
add_date_t="$(date -d "$add_date" "+%Y-%m-%d %H:%M")"
2930
dater="$(date "+%Y-%m-%d %H:%M")"
3031
dateo="$(date -d "1 minutes ago" "+%Y-%m-%d %H:%M")"
3132

3233
if [ ! -f /tmp/TTAA.$id.lock ]; then
3334
if [[ ( "$add_date_t" == "$dater" || "$add_date_t" == "$dateo" ) ]]; then
34-
hash="$(transmission-remote --auth="$auth" --torrent "$id" --info | grep '^ Hash: ' | awk '{ print $2 }')"
35-
torrent_name="$(transmission-remote --auth="$auth" --torrent "$id" --info | grep '^ Name: ' |cut -c 9-)"
35+
hash="$(transmission-remote "$host" --auth="$auth" --torrent "$id" --info | grep '^ Hash: ' | awk '{ print $2 }')"
36+
torrent_name="$(transmission-remote "$host" --auth="$auth" --torrent "$id" --info | grep '^ Name: ' |cut -c 9-)"
3637
add_trackers "$hash" "$id" &
3738
touch /tmp/TTAA.$id.lock
3839
fi

0 commit comments

Comments
 (0)