Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.cache
13 changes: 7 additions & 6 deletions transmission-trackers-auto-cron.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
#!/bin/bash
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" > /dev/null && pwd)"

# If you are using transmission-daemon directly on system the below code will ensure that trackers script run only when it is running
if [ "$(systemctl is-active transmission-daemon)" = "active" ]
then
/usr/bin/python3 [path]]/transmission-trackers.py
/usr/bin/python3 $DIR/transmission-trackers.py
fi

# If you are using docker for transmission use the following. Replace 'docker-container-name' with the appropriate name
if [ "$( docker container inspect -f '{{.State.Running}}' 'docker-container-name' )" = "true" ]
then
/usr/bin/python3 [path]]/transmission-trackers.py
fi
# If you are using docker for transmission use the following. Replace 'docker-container-name' with the appropriate name and uncomment the following
#if [ "$( docker container inspect -f '{{.State.Running}}' 'docker-container-name' )" = "true" ]
#then
#/usr/bin/python3 $DIR/transmission-trackers.py
#fi
5 changes: 3 additions & 2 deletions transmission-trackers.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
'silent': False,

# Debug output
'debug': False
'debug': True
}

cache_file = None # Universal scope
Expand Down Expand Up @@ -253,7 +253,8 @@ def readLocalLists():
for trk in t.trackers:
ttrk.add(getattr(trk, 'fields', trk).get('announce'))

if any(tracker in url for url in ttrk for tracker in config['tracker_filter']):
# Use .get() to avoid error if key doesn't exist
if any(tracker in url for url in ttrk for tracker in config.get('tracker_filter', [])):
dbg('{}: skipping due to tracker filter'.format(t.name))
continue

Expand Down