|
1 | 1 | #!/usr/bin/env python3
|
2 | 2 | from __future__ import print_function
|
| 3 | +import socket |
| 4 | +import time |
| 5 | +import os |
| 6 | +import sys |
| 7 | +from os import getcwd |
3 | 8 |
|
4 | 9 | # Host, port, username and password to connect to Transmission
|
5 | 10 | # Set user and pw to None if auth is not required
|
|
46 | 51 | # Debug output
|
47 | 52 | 'debug': False
|
48 | 53 | }
|
| 54 | + |
49 | 55 | cache_file = None # Universal scope
|
50 |
| -from os import getcwd |
51 | 56 | if getcwd() != '/docker/transmission/transmission-trackers':
|
52 | 57 | from os import environ as env, path, mkdir
|
53 | 58 | try:
|
|
69 | 74 | toml.dump( {'client': client, 'config': config }, f )
|
70 | 75 | except KeyError:
|
71 | 76 | # Where to cache downloaded lists
|
72 |
| - cache_file = path.join(env['TEMP'] ,'.cache/trackers.txt') |
| 77 | + cache_file = path.join(env['TEMP'] ,'.cache/trackers.txt') |
73 | 78 | else:
|
74 | 79 | cache_file = '/tmp/trackers_cache.txt'
|
75 | 80 |
|
76 | 81 |
|
77 |
| - |
78 | 82 | ### Configuration ends here ###
|
79 | 83 | hdrs = {'User-Agent': 'Mozilla/5.0'}
|
80 | 84 | hosts, ips = set(()), set(())
|
81 | 85 |
|
82 |
| -import sys, os, time, socket |
83 | 86 | try:
|
84 | 87 | from transmissionrpc import Client
|
85 | 88 | if 'host' in client:
|
@@ -237,13 +240,13 @@ def readLocalLists():
|
237 | 240 | if config['status_filter'] and not t.status in config['status_filter']:
|
238 | 241 | dbg('{}: skipping due to status filter'.format(t.name))
|
239 | 242 | continue
|
240 |
| - if t.isPrivate: |
| 243 | + if getattr(t, 'isPrivate', getattr(t, 'is_private', False)): |
241 | 244 | dbg('{}: skipping private torrent'.format(t.name))
|
242 | 245 | continue
|
243 | 246 |
|
244 | 247 | ttrk = set(())
|
245 | 248 | for trk in t.trackers:
|
246 |
| - ttrk.add(trk['announce']) |
| 249 | + ttrk.add(getattr(trk, 'fields', trk).get('announce')) |
247 | 250 |
|
248 | 251 | diff = trackers - ttrk
|
249 | 252 |
|
|
0 commit comments