Skip to content

Commit a3222aa

Browse files
committed
Fix backward compatibility between trpc and t-rpc
See-also: e7ddfb7 (add support for transmission-rpc (newer fork)) Signed-off-by: Mubashshir <[email protected]>
1 parent 9361e6c commit a3222aa

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

transmission-trackers.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
#!/usr/bin/env python3
22
from __future__ import print_function
3+
import socket
4+
import time
5+
import os
6+
import sys
7+
from os import getcwd
38

49
# Host, port, username and password to connect to Transmission
510
# Set user and pw to None if auth is not required
@@ -46,8 +51,8 @@
4651
# Debug output
4752
'debug': False
4853
}
54+
4955
cache_file = None # Universal scope
50-
from os import getcwd
5156
if getcwd() != '/docker/transmission/transmission-trackers':
5257
from os import environ as env, path, mkdir
5358
try:
@@ -69,17 +74,15 @@
6974
toml.dump( {'client': client, 'config': config }, f )
7075
except KeyError:
7176
# 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')
7378
else:
7479
cache_file = '/tmp/trackers_cache.txt'
7580

7681

77-
7882
### Configuration ends here ###
7983
hdrs = {'User-Agent': 'Mozilla/5.0'}
8084
hosts, ips = set(()), set(())
8185

82-
import sys, os, time, socket
8386
try:
8487
from transmissionrpc import Client
8588
if 'host' in client:
@@ -237,13 +240,13 @@ def readLocalLists():
237240
if config['status_filter'] and not t.status in config['status_filter']:
238241
dbg('{}: skipping due to status filter'.format(t.name))
239242
continue
240-
if t.isPrivate:
243+
if getattr(t, 'isPrivate', getattr(t, 'is_private', False)):
241244
dbg('{}: skipping private torrent'.format(t.name))
242245
continue
243246

244247
ttrk = set(())
245248
for trk in t.trackers:
246-
ttrk.add(trk['announce'])
249+
ttrk.add(getattr(trk, 'fields', trk).get('announce'))
247250

248251
diff = trackers - ttrk
249252

0 commit comments

Comments
 (0)