Skip to content

Commit d229313

Browse files
first commit
1 parent 9251aa9 commit d229313

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

Dockerfile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
FROM alpine:latest
2+
3+
COPY ./tracker-add-auto.sh /opt/tracker-add-auto.sh
4+
5+
RUN apk add --update \
6+
bash \ &&
7+
rm -rf /var/cache/apk/* \ &&
8+
chmod +x /opt/tracker-add-auto.sh
9+
10+
USER guest
11+
ENTRYPOINT [ "/opt/tracker-add-auto.sh" ]

tracker-add-auto.sh

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
#!/bin/bash
2-
# Get transmission credentials and ip or dns address
3-
auth=user:password
4-
host=localhost
52

63
while true ; do
74
sleep 25
@@ -13,7 +10,7 @@ for base_url in https://raw.githubusercontent.com/ngosang/trackerslist/master/tr
1310
echo "Adding trackers for $torrent_name..."
1411
for tracker in $(curl -# "${base_url}") ; do
1512
echo -n "${tracker}..."
16-
if transmission-remote "$host" --auth="$auth" --torrent "${torrent_hash}" -td "${tracker}" | grep -q 'success'; then
13+
if transmission-remote "$HOSTPORT" --authenv --torrent "${torrent_hash}" -td "${tracker}" | grep -q 'success'; then
1714
echo ' failed.'
1815
else
1916
echo ' done.'
@@ -24,17 +21,17 @@ done
2421
rm -f /tmp/TTAA.$id.lock
2522
}
2623
# Get list of active torrents
27-
ids="$(transmission-remote "$host" --auth="$auth" --list | grep -vE 'Seeding|Stopped|Finished' | grep '^ ' | awk '{ print $1 }')"
24+
ids="$(transmission-remote "$HOSTPORT" --authenv --list | grep -vE 'Seeding|Stopped|Finished' | grep '^ ' | awk '{ print $1 }')"
2825
for id in $ids ; do
29-
add_date="$(transmission-remote "$host" --auth="$auth" --torrent "$id" --info| grep '^ Date added: ' |cut -c 21-)"
26+
add_date="$(transmission-remote "$HOSTPORT" --authenv --torrent "$id" --info| grep '^ Date added: ' |cut -c 21-)"
3027
add_date_t="$(date -d "$add_date" "+%Y-%m-%d %H:%M")"
3128
dater="$(date "+%Y-%m-%d %H:%M")"
3229
dateo="$(date -d "1 minutes ago" "+%Y-%m-%d %H:%M")"
3330

3431
if [ ! -f /tmp/TTAA.$id.lock ]; then
3532
if [[ ( "$add_date_t" == "$dater" || "$add_date_t" == "$dateo" ) ]]; then
36-
hash="$(transmission-remote "$host" --auth="$auth" --torrent "$id" --info | grep '^ Hash: ' | awk '{ print $2 }')"
37-
torrent_name="$(transmission-remote "$host" --auth="$auth" --torrent "$id" --info | grep '^ Name: ' |cut -c 9-)"
33+
hash="$(transmission-remote "$HOSTPORT" --authenv --torrent "$id" --info | grep '^ Hash: ' | awk '{ print $2 }')"
34+
torrent_name="$(transmission-remote "$HOSTPORT" --authenv --torrent "$id" --info | grep '^ Name: ' |cut -c 9-)"
3835
add_trackers "$hash" "$id" &
3936
touch /tmp/TTAA.$id.lock
4037
fi

0 commit comments

Comments
 (0)