oops
This commit is contained in:
parent
dc9d014802
commit
3cc3092cb0
1 changed files with 52 additions and 37 deletions
|
@ -2,20 +2,33 @@
|
||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
sleep ${INTERVAL:-25}
|
sleep ${INTERVAL:-25}
|
||||||
|
|
||||||
add_trackers() {
|
add_trackers() {
|
||||||
torrent_hash=$1
|
torrent_hash=$1
|
||||||
id=$2
|
id=$2
|
||||||
for base_url in "$TORRENTLIST"; do
|
for base_url in "$TORRENTLIST"; do
|
||||||
if [ ! -f /tmp/trackers.txt ]; then
|
if [ ! -f /tmp/trackers.txt ]; then
|
||||||
curl -o "/tmp/trackers.txt" "${base_url}"
|
curl -o "/tmp/trackers.txt" "${base_url}"
|
||||||
|
|
||||||
|
if [ -f /opt/trackers.txt ]; then
|
||||||
|
cat /opt/trackers.txt >>/tmp/trackers.txt
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
Local=$(wc -c </tmp/trackers.txt)
|
Local=$(wc -c </tmp/trackers.txt)
|
||||||
Remote=$(curl -sI "${base_url}" | awk '/Content-Length/ {sub("\r",""); print $2}')
|
Remote=$(curl -sI "${base_url}" | awk '/Content-Length/ {sub("\r",""); print $2}')
|
||||||
|
|
||||||
if [ $Local != $Remote ]; then
|
if [ $Local != $Remote ]; then
|
||||||
curl -o "/tmp/trackers.txt" "${base_url}"
|
curl -o "/tmp/trackers.txt" "${base_url}"
|
||||||
|
|
||||||
|
if [ -f /opt/trackers.txt ]; then
|
||||||
|
cat /opt/trackers.txt >>/tmp/trackers.txt
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
echo "URL for ${base_url}"
|
echo "URL for ${base_url}"
|
||||||
echo "Adding trackers for $torrent_name..."
|
echo "Adding trackers for $torrent_name..."
|
||||||
|
|
||||||
for tracker in $(cat /tmp/trackers.txt); do
|
for tracker in $(cat /tmp/trackers.txt); do
|
||||||
echo -n "${tracker}..."
|
echo -n "${tracker}..."
|
||||||
if transmission-remote "$HOSTPORT" --authenv --torrent "${torrent_hash}" -td "${tracker}" | grep -q 'success'; then
|
if transmission-remote "$HOSTPORT" --authenv --torrent "${torrent_hash}" -td "${tracker}" | grep -q 'success'; then
|
||||||
|
@ -25,9 +38,11 @@ else
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
|
|
||||||
sleep 3m
|
sleep 3m
|
||||||
rm -f /tmp/TTAA.$id.lock
|
rm -f /tmp/TTAA.$id.lock
|
||||||
}
|
}
|
||||||
|
|
||||||
# Get list of active torrents
|
# Get list of active torrents
|
||||||
ids="$(transmission-remote "$HOSTPORT" --authenv --list | grep -vE 'Seeding|Stopped|Finished|[[:space:]]100%[[:space:]]' | grep '^ ' | awk '{ print $1 }')"
|
ids="$(transmission-remote "$HOSTPORT" --authenv --list | grep -vE 'Seeding|Stopped|Finished|[[:space:]]100%[[:space:]]' | grep '^ ' | awk '{ print $1 }')"
|
||||||
for id in $ids; do
|
for id in $ids; do
|
||||||
|
|
Loading…
Add table
Reference in a new issue