mirror of
https://github.com/correl/Transmission-XBMC.git
synced 2024-11-25 19:19:56 +00:00
Show a 'connecting' dialog, fail gracefully if the connection attempt fails
This commit is contained in:
parent
2aae505544
commit
ce5790be3c
2 changed files with 18 additions and 4 deletions
|
@ -2,6 +2,9 @@
|
||||||
<strings>
|
<strings>
|
||||||
<string id="0">Transmission</string>
|
<string id="0">Transmission</string>
|
||||||
|
|
||||||
|
<string id="1">Connecting to Transmission</string>
|
||||||
|
<string id="2">Transmission Error</string>
|
||||||
|
|
||||||
<!-- Buttons -->
|
<!-- Buttons -->
|
||||||
<string id="101">Add</string>
|
<string id="101">Add</string>
|
||||||
<string id="102">Remove</string>
|
<string id="102">Remove</string>
|
||||||
|
|
|
@ -21,16 +21,27 @@ CANCEL_DIALOG = EXIT_SCRIPT + ( 216, 257, 61448, )
|
||||||
|
|
||||||
class TransmissionGUI(xbmcgui.WindowXMLDialog):
|
class TransmissionGUI(xbmcgui.WindowXMLDialog):
|
||||||
def __init__(self, strXMLname, strFallbackPath, strDefaultName, bforeFallback=0):
|
def __init__(self, strXMLname, strFallbackPath, strDefaultName, bforeFallback=0):
|
||||||
|
self.list = {}
|
||||||
|
self.torrents = {}
|
||||||
|
def onInit(self):
|
||||||
|
p = xbmcgui.DialogProgress()
|
||||||
|
p.create(_(0), _(1)) # 'Transmission', 'Connecting to Transmission'
|
||||||
params = {
|
params = {
|
||||||
'address': __settings__.getSetting('rpc_host'),
|
'address': __settings__.getSetting('rpc_host'),
|
||||||
'port': __settings__.getSetting('rpc_port'),
|
'port': __settings__.getSetting('rpc_port'),
|
||||||
'user': __settings__.getSetting('rpc_user'),
|
'user': __settings__.getSetting('rpc_user'),
|
||||||
'password': __settings__.getSetting('rpc_password')
|
'password': __settings__.getSetting('rpc_password')
|
||||||
}
|
}
|
||||||
self.transmission = transmissionrpc.transmission.Client(**params)
|
try:
|
||||||
self.list = {}
|
self.transmission = transmissionrpc.transmission.Client(**params)
|
||||||
self.torrents = {}
|
except transmissionrpc.transmission.TransmissionError:
|
||||||
def onInit(self):
|
p.close()
|
||||||
|
d = xbmcgui.Dialog()
|
||||||
|
(type, e, traceback) = sys.exc_info()
|
||||||
|
d.ok(_(2), e.message) # 'Transmission Error'
|
||||||
|
self.close()
|
||||||
|
return False
|
||||||
|
p.close()
|
||||||
self.updateTorrents()
|
self.updateTorrents()
|
||||||
self.repeater = Repeater(1.0, self.updateTorrents)
|
self.repeater = Repeater(1.0, self.updateTorrents)
|
||||||
self.repeater.start()
|
self.repeater.start()
|
||||||
|
|
Loading…
Reference in a new issue