Skip to content

Commit d6153fe

Browse files
committed
- Fixed KeyError: 'tracker_filter' blind-oracle#22
- Fixed transmission-trackers-auto-cron.sh to find path correctly. - Added .gitignore to ignore the .cache folder
1 parent 561349c commit d6153fe

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.cache

transmission-trackers-auto-cron.sh

100644100755
Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
#!/bin/bash
2+
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" > /dev/null && pwd)"
23

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

9-
# If you are using docker for transmission use the following. Replace 'docker-container-name' with the appropriate name
10-
if [ "$( docker container inspect -f '{{.State.Running}}' 'docker-container-name' )" = "true" ]
11-
then
12-
/usr/bin/python3 [path]]/transmission-trackers.py
13-
fi
10+
# If you are using docker for transmission use the following. Replace 'docker-container-name' with the appropriate name and uncomment the following
11+
#if [ "$( docker container inspect -f '{{.State.Running}}' 'docker-container-name' )" = "true" ]
12+
#then
13+
#/usr/bin/python3 $DIR/transmission-trackers.py
14+
#fi

transmission-trackers.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
'silent': False,
5555

5656
# Debug output
57-
'debug': False
57+
'debug': True
5858
}
5959

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

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

0 commit comments

Comments
 (0)