Skip to content

Commit e7ddfb7

Browse files
committed
add support for transmission-rpc (newer fork)
1 parent 09269e9 commit e7ddfb7

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

transmission-trackers.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,15 @@
4545
hdrs = {'User-Agent': 'Mozilla/5.0'}
4646
hosts, ips = set(()), set(())
4747

48-
import transmissionrpc, sys, os, time, socket
48+
import sys, os, time, socket
49+
try:
50+
from transmissionrpc import Client
51+
except ImportError:
52+
try
53+
from transmission_rpc import Client
54+
except ImportError:
55+
print("neither transmissionrpc nor transmission-rpc is installed")
56+
exit()
4957

5058
if sys.version_info[0] == 2:
5159
from urllib import Request, urlopen
@@ -173,7 +181,10 @@ def readLocalLists():
173181
exit(1)
174182

175183
try:
176-
tc = transmissionrpc.Client(host, port=port, user=user, password=pw)
184+
if Client.__module__ == 'transmission_rpc.client':
185+
tc = Client(host=host, port=port, username=user, password=pw)
186+
else:
187+
tc = Client(host, port=port, user=user, password=pw)
177188
except:
178189
if not err_on_connect:
179190
exit()

0 commit comments

Comments
 (0)