mirror of
https://github.com/correl/Transmission-XBMC.git
synced 2024-11-28 19:19:56 +00:00
Merge branch 'pr/14'
Conflicts: resources/language/Russian/strings.xml resources/lib/gui.py
This commit is contained in:
commit
6d227f0cf9
7 changed files with 55 additions and 11 deletions
|
@ -14,6 +14,7 @@
|
||||||
<string id="105">Pause All</string>
|
<string id="105">Pause All</string>
|
||||||
<string id="106">Start All</string>
|
<string id="106">Start All</string>
|
||||||
<string id="107">Exit</string>
|
<string id="107">Exit</string>
|
||||||
|
<string id="108">Settings</string>
|
||||||
|
|
||||||
<string id="110">Name</string>
|
<string id="110">Name</string>
|
||||||
<string id="111">Status</string>
|
<string id="111">Status</string>
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
<string id="105">Остановить все</string>
|
<string id="105">Остановить все</string>
|
||||||
<string id="106">Запустить все</string>
|
<string id="106">Запустить все</string>
|
||||||
<string id="107">Выход</string>
|
<string id="107">Выход</string>
|
||||||
|
<string id="108">Настойки</string>
|
||||||
|
|
||||||
<string id="110">Название</string>
|
<string id="110">Название</string>
|
||||||
<string id="111">Статус</string>
|
<string id="111">Статус</string>
|
||||||
|
|
|
@ -30,24 +30,34 @@ class TransmissionGUI(xbmcgui.WindowXMLDialog):
|
||||||
self.list = {}
|
self.list = {}
|
||||||
self.torrents = {}
|
self.torrents = {}
|
||||||
self.timer = None
|
self.timer = None
|
||||||
def onInit(self):
|
def get_settings(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')
|
||||||
}
|
}
|
||||||
|
return params
|
||||||
|
def set_settings(self, params):
|
||||||
|
__settings__.setSetting('rpc_host', params['address'])
|
||||||
|
__settings__.setSetting('rpc_port', params['port'])
|
||||||
|
__settings__.setSetting('rpc_user', params['user'])
|
||||||
|
__settings__.setSetting('rpc_password', params['password'])
|
||||||
|
def get_rpc_client(self):
|
||||||
|
params = self.get_settings()
|
||||||
import transmissionrpc
|
import transmissionrpc
|
||||||
|
return transmissionrpc.Client(**params)
|
||||||
|
def onInit(self):
|
||||||
|
p = xbmcgui.DialogProgress()
|
||||||
|
p.create(_(0), _(1)) # 'Transmission', 'Connecting to Transmission'
|
||||||
try:
|
try:
|
||||||
self.transmission = transmissionrpc.Client(**params)
|
self.transmission = self.get_rpc_client()
|
||||||
except:
|
except:
|
||||||
p.close()
|
p.close()
|
||||||
self.close()
|
self.close()
|
||||||
(type, e, traceback) = sys.exc_info()
|
(type, e, traceback) = sys.exc_info()
|
||||||
|
|
||||||
message = _(9000) # Unexpected error
|
message = _(9000) # Unexpected error
|
||||||
|
import transmissionrpc
|
||||||
if type is transmissionrpc.TransmissionError:
|
if type is transmissionrpc.TransmissionError:
|
||||||
if e.original:
|
if e.original:
|
||||||
if e.original.code is 401:
|
if e.original.code is 401:
|
||||||
|
@ -65,7 +75,6 @@ class TransmissionGUI(xbmcgui.WindowXMLDialog):
|
||||||
else:
|
else:
|
||||||
message = _(9000) # Unexpected error
|
message = _(9000) # Unexpected error
|
||||||
xbmcgui.Dialog().ok(_(2), message)
|
xbmcgui.Dialog().ok(_(2), message)
|
||||||
|
|
||||||
return False
|
return False
|
||||||
self.updateTorrents()
|
self.updateTorrents()
|
||||||
p.close()
|
p.close()
|
||||||
|
@ -181,6 +190,26 @@ class TransmissionGUI(xbmcgui.WindowXMLDialog):
|
||||||
if (controlID == 117):
|
if (controlID == 117):
|
||||||
# Exit button
|
# Exit button
|
||||||
self.close()
|
self.close()
|
||||||
|
if (controlID == 118):
|
||||||
|
# Settings button
|
||||||
|
prev_settings = self.get_settings()
|
||||||
|
__settings__.openSettings()
|
||||||
|
p = xbmcgui.DialogProgress()
|
||||||
|
p.create(_(0), _(1)) # 'Transmission', 'Connecting to Transmission'
|
||||||
|
try:
|
||||||
|
self.transmission = self.get_rpc_client()
|
||||||
|
self.updateTorrents()
|
||||||
|
p.close()
|
||||||
|
except:
|
||||||
|
p.close()
|
||||||
|
xbmcgui.Dialog().ok(_(2), _(9001))
|
||||||
|
# restore settings
|
||||||
|
self.set_settings(prev_settings)
|
||||||
|
try:
|
||||||
|
self.transmission = self.get_rpc_client()
|
||||||
|
except err:
|
||||||
|
xbmcgui.Dialog().ok(_(2), _(9001))
|
||||||
|
self.close()
|
||||||
if (controlID == 120):
|
if (controlID == 120):
|
||||||
# A torrent was chosen, show details
|
# A torrent was chosen, show details
|
||||||
item = list.getSelectedItem()
|
item = list.getSelectedItem()
|
||||||
|
|
|
@ -135,8 +135,8 @@
|
||||||
<texturefocus>startall-focus.png</texturefocus>
|
<texturefocus>startall-focus.png</texturefocus>
|
||||||
<texturenofocus>startall-nofocus.png</texturenofocus>
|
<texturenofocus>startall-nofocus.png</texturenofocus>
|
||||||
</control>
|
</control>
|
||||||
<control type="button" id="117">
|
<control type="button" id="118">
|
||||||
<description>Exit</description>
|
<description>Settings</description>
|
||||||
<posx>0</posx>
|
<posx>0</posx>
|
||||||
<posy>450</posy>
|
<posy>450</posy>
|
||||||
<height>70</height>
|
<height>70</height>
|
||||||
|
@ -144,12 +144,12 @@
|
||||||
<align>center</align>
|
<align>center</align>
|
||||||
<aligny>top</aligny>
|
<aligny>top</aligny>
|
||||||
<textoffsety>45</textoffsety>
|
<textoffsety>45</textoffsety>
|
||||||
<label>SCRIPT107</label>
|
<label>SCRIPT108</label>
|
||||||
<font>font12_title</font>
|
<font>font12_title</font>
|
||||||
<onright>120</onright>
|
<onright>120</onright>
|
||||||
<onup>116</onup>
|
<onup>116</onup>
|
||||||
<texturefocus>exit-focus.png</texturefocus>
|
<texturefocus>settings-focus.png</texturefocus>
|
||||||
<texturenofocus>exit-nofocus.png</texturenofocus>
|
<texturenofocus>settings-nofocus.png</texturenofocus>
|
||||||
<ondown>111</ondown>
|
<ondown>111</ondown>
|
||||||
</control>
|
</control>
|
||||||
</control>
|
</control>
|
||||||
|
@ -275,5 +275,18 @@
|
||||||
</control>
|
</control>
|
||||||
</focusedlayout>
|
</focusedlayout>
|
||||||
</control>
|
</control>
|
||||||
|
<control type="button" id="117">
|
||||||
|
<description>Exit</description>
|
||||||
|
<posx>850</posx>
|
||||||
|
<posy>-5</posy>
|
||||||
|
<height>32</height>
|
||||||
|
<width>64</width>
|
||||||
|
<textoffsety>45</textoffsety>
|
||||||
|
<label>-</label>
|
||||||
|
<font>-</font>
|
||||||
|
<texturefocus>DialogCloseButton-focus.png</texturefocus>
|
||||||
|
<texturenofocus>DialogCloseButton.png</texturenofocus>
|
||||||
|
<visible>system.getbool(input.enablemouse)</visible>
|
||||||
|
</control>
|
||||||
</controls>
|
</controls>
|
||||||
</window>
|
</window>
|
||||||
|
|
BIN
resources/skins/Default/media/icons/configure.png
Normal file
BIN
resources/skins/Default/media/icons/configure.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 10 KiB |
BIN
resources/skins/Default/media/settings-focus.png
Normal file
BIN
resources/skins/Default/media/settings-focus.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.7 KiB |
BIN
resources/skins/Default/media/settings-nofocus.png
Normal file
BIN
resources/skins/Default/media/settings-nofocus.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.5 KiB |
Loading…
Reference in a new issue