This commit is contained in:
Lilith Ashley Nyx Arson 🔥 2024-11-03 20:54:33 +01:00
parent c134ca7337
commit 7fb3309f7e
Signed by: lilith
SSH key fingerprint: SHA256:LAjgsAMyT3LO2JVtr6fQ4N3RTYoRRlIm5wAKsbDife4
3 changed files with 25 additions and 33 deletions

View file

@ -5,8 +5,8 @@ ENV TORRENTLIST=https://raw.githubusercontent.com/ngosang/trackerslist/master/tr
RUN apk add --update bash transmission-remote curl coreutils && \
rm -rf /var/cache/apk/*
COPY ./tracker-add-auto.sh /opt/tracker-add-auto.sh
RUN chmod +x /opt/tracker-add-auto.sh
COPY trackers.txt /opt/trackers.txt
COPY tracker-add-auto.sh /opt/tracker-add-auto.sh
USER guest
ENTRYPOINT [ "/opt/tracker-add-auto.sh" ]

53
tracker-add-auto.sh Normal file → Executable file
View file

@ -4,37 +4,17 @@ add_trackers() {
torrent_hash=$1
torrent_name=$2
id=$3
for base_url in "$TORRENTLIST"; do
if [ ! -f /tmp/trackers.txt ]; then
curl -o "/tmp/trackers.txt" "${base_url}"
if [ -f /opt/trackers.txt ]; then
cat /opt/trackers.txt >>/tmp/trackers.txt
fi
echo "URL for ${base_url}"
echo "Adding trackers for $torrent_name ($torrent_hash)"
for tracker in $(cat /tmp/trackers.txt); do
echo -n "${tracker}..."
if transmission-remote "$HOSTPORT" --authenv --torrent "${torrent_hash}" -td "${tracker}" | grep -q 'success'; then
echo ' failed.'
else
echo ' done.'
fi
local=$(wc -c </tmp/trackers.txt)
remote=$(curl -sI "${base_url}" | awk '/Content-Length/ {sub("\r",""); print $2}')
if [ "$local" != "$remote" ]; then
curl -o "/tmp/trackers.txt" "${base_url}"
if [ -f /opt/trackers.txt ]; then
cat /opt/trackers.txt >>/tmp/trackers.txt
fi
fi
echo "URL for ${base_url}"
echo "Adding trackers for $torrent_name ($torrent_hash)"
for tracker in $(cat /tmp/trackers.txt); do
echo -n "${tracker}..."
if transmission-remote "$HOSTPORT" --authenv --torrent "${torrent_hash}" -td "${tracker}" | grep -q 'success'; then
echo ' failed.'
else
echo ' done.'
fi
done
done
sleep 3m
@ -42,10 +22,20 @@ add_trackers() {
}
while true; do
if [ ! -f /tmp/trackers.txt ] || [[ $(find "/tmp/trackers.txt" -mtime +1 -print) ]]; then
for base_url in "$TORRENTLIST"; do
curl -so "/tmp/trackers.txt" "${base_url}"
if [ -f /opt/trackers.txt ]; then
cat /opt/trackers.txt >>/tmp/trackers.txt
fi
done
fi
# 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 'ETA|Seeding|Stopped|Finished|[[:space:]]100%[[:space:]]' | grep '^ ' | awk '{ print $1 }')"
for id in $ids; do
echo Processing $id
echo "Processing: $id"
if [ ! -f /tmp/TTAA.$id.lock ]; then
hash="$(transmission-remote "$HOSTPORT" --authenv --torrent "$id" --info | grep '^ Hash: ' | awk '{ print $2 }')"
@ -54,6 +44,7 @@ while true; do
touch /tmp/TTAA.$id.lock
fi
done
wait
sleep ${INTERVAL:-25}
done

1
trackers.txt Normal file
View file

@ -0,0 +1 @@
udp://incest.world:6969/announce