mirror of
https://github.com/correl/Transmission-XBMC.git
synced 2024-11-25 11:09:57 +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>
|
||||
<string id="0">Transmission</string>
|
||||
|
||||
<string id="1">Connecting to Transmission</string>
|
||||
<string id="2">Transmission Error</string>
|
||||
|
||||
<!-- Buttons -->
|
||||
<string id="101">Add</string>
|
||||
<string id="102">Remove</string>
|
||||
|
|
|
@ -21,16 +21,27 @@ CANCEL_DIALOG = EXIT_SCRIPT + ( 216, 257, 61448, )
|
|||
|
||||
class TransmissionGUI(xbmcgui.WindowXMLDialog):
|
||||
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 = {
|
||||
'address': __settings__.getSetting('rpc_host'),
|
||||
'port': __settings__.getSetting('rpc_port'),
|
||||
'user': __settings__.getSetting('rpc_user'),
|
||||
'password': __settings__.getSetting('rpc_password')
|
||||
}
|
||||
try:
|
||||
self.transmission = transmissionrpc.transmission.Client(**params)
|
||||
self.list = {}
|
||||
self.torrents = {}
|
||||
def onInit(self):
|
||||
except transmissionrpc.transmission.TransmissionError:
|
||||
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.repeater = Repeater(1.0, self.updateTorrents)
|
||||
self.repeater.start()
|
||||
|
|
Loading…
Reference in a new issue