first commit
This commit is contained in:
parent
9251aa91c6
commit
d22931389c
2 changed files with 16 additions and 8 deletions
11
Dockerfile
Normal file
11
Dockerfile
Normal file
|
@ -0,0 +1,11 @@
|
|||
FROM alpine:latest
|
||||
|
||||
COPY ./tracker-add-auto.sh /opt/tracker-add-auto.sh
|
||||
|
||||
RUN apk add --update \
|
||||
bash \ &&
|
||||
rm -rf /var/cache/apk/* \ &&
|
||||
chmod +x /opt/tracker-add-auto.sh
|
||||
|
||||
USER guest
|
||||
ENTRYPOINT [ "/opt/tracker-add-auto.sh" ]
|
|
@ -1,7 +1,4 @@
|
|||
#!/bin/bash
|
||||
# Get transmission credentials and ip or dns address
|
||||
auth=user:password
|
||||
host=localhost
|
||||
|
||||
while true ; do
|
||||
sleep 25
|
||||
|
@ -13,7 +10,7 @@ for base_url in https://raw.githubusercontent.com/ngosang/trackerslist/master/tr
|
|||
echo "Adding trackers for $torrent_name..."
|
||||
for tracker in $(curl -# "${base_url}") ; do
|
||||
echo -n "${tracker}..."
|
||||
if transmission-remote "$host" --auth="$auth" --torrent "${torrent_hash}" -td "${tracker}" | grep -q 'success'; then
|
||||
if transmission-remote "$HOSTPORT" --authenv --torrent "${torrent_hash}" -td "${tracker}" | grep -q 'success'; then
|
||||
echo ' failed.'
|
||||
else
|
||||
echo ' done.'
|
||||
|
@ -24,17 +21,17 @@ done
|
|||
rm -f /tmp/TTAA.$id.lock
|
||||
}
|
||||
# Get list of active torrents
|
||||
ids="$(transmission-remote "$host" --auth="$auth" --list | grep -vE 'Seeding|Stopped|Finished' | grep '^ ' | awk '{ print $1 }')"
|
||||
ids="$(transmission-remote "$HOSTPORT" --authenv --list | grep -vE 'Seeding|Stopped|Finished' | grep '^ ' | awk '{ print $1 }')"
|
||||
for id in $ids ; do
|
||||
add_date="$(transmission-remote "$host" --auth="$auth" --torrent "$id" --info| grep '^ Date added: ' |cut -c 21-)"
|
||||
add_date="$(transmission-remote "$HOSTPORT" --authenv --torrent "$id" --info| grep '^ Date added: ' |cut -c 21-)"
|
||||
add_date_t="$(date -d "$add_date" "+%Y-%m-%d %H:%M")"
|
||||
dater="$(date "+%Y-%m-%d %H:%M")"
|
||||
dateo="$(date -d "1 minutes ago" "+%Y-%m-%d %H:%M")"
|
||||
|
||||
if [ ! -f /tmp/TTAA.$id.lock ]; then
|
||||
if [[ ( "$add_date_t" == "$dater" || "$add_date_t" == "$dateo" ) ]]; then
|
||||
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-)"
|
||||
hash="$(transmission-remote "$HOSTPORT" --authenv --torrent "$id" --info | grep '^ Hash: ' | awk '{ print $2 }')"
|
||||
torrent_name="$(transmission-remote "$HOSTPORT" --authenv --torrent "$id" --info | grep '^ Name: ' |cut -c 9-)"
|
||||
add_trackers "$hash" "$id" &
|
||||
touch /tmp/TTAA.$id.lock
|
||||
fi
|
||||
|
|
Loading…
Add table
Reference in a new issue