diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..16d3c4d --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.cache diff --git a/transmission-trackers-auto-cron.sh b/transmission-trackers-auto-cron.sh old mode 100644 new mode 100755 index 7aca918..b4cc0e7 --- a/transmission-trackers-auto-cron.sh +++ b/transmission-trackers-auto-cron.sh @@ -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 \ No newline at end of file +# 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 diff --git a/transmission-trackers.py b/transmission-trackers.py index 3a5e8c6..203ec20 100755 --- a/transmission-trackers.py +++ b/transmission-trackers.py @@ -54,7 +54,7 @@ 'silent': False, # Debug output - 'debug': False + 'debug': True } cache_file = None # Universal scope @@ -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