add feature host

This commit is contained in:
AndrewMarchukov 2019-02-22 09:46:33 +04:00
parent d0746599b5
commit 86e3af2f90
2 changed files with 6 additions and 4 deletions

View file

@ -1,6 +1,7 @@
#!/bin/bash
# Get transmission credentials
auth=user:password
host=localhost
add_trackers () {
torrent_hash=$1
@ -13,7 +14,7 @@ add_trackers () {
for tracker in $(curl -# "${base_url}") ; do
echo -en "\e[0m"
echo -ne "\e[93m*\e[0m ${tracker}..."
if transmission-remote --auth="$auth" --torrent "${torrent_hash}" -td "${tracker}" | grep -q 'success'; then
if transmission-remote "$host" --auth="$auth" --torrent "${torrent_hash}" -td "${tracker}" | grep -q 'success'; then
echo -e '\e[91m failed.'
echo -en "\e[0m"
else
@ -25,10 +26,10 @@ done
}
# Get list of active torrents
ids="$(transmission-remote --auth="$auth" --list | grep -vE 'Seeding|Stopped|Finished' | grep '^ ' | awk '{ print $1 }')"
ids="$(transmission-remote "$host" --auth="$auth" --list | grep -vE 'Seeding|Stopped|Finished' | grep '^ ' | awk '{ print $1 }')"
for id in $ids ; do
hash="$(transmission-remote --auth="$auth" --torrent "$id" --info | grep '^ Hash: ' | awk '{ print $2 }')"
torrent_name="$(transmission-remote --auth="$auth" --torrent "$id" --info | grep '^ Name: ' |cut -c 9-)"
hash="$(transmission-remote "$host" --auth="$auth" --torrent "$id" --info | grep '^ Hash: ' | awk '{ print $2 }')"
torrent_name="$(transmission-remote "$host" --auth="$auth" --torrent "$id" --info | grep '^ Name: ' |cut -c 9-)"
add_trackers "$hash"
done

View file

@ -2,6 +2,7 @@
# Get transmission credentials and ip or dns ardress
auth=user:password
host=localhost
while true ; do
sleep 25
add_trackers () {