mirror of
https://github.com/correl/Transmission-XBMC.git
synced 2025-01-21 11:07:22 +00:00
Filtering torrents by status
This commit is contained in:
parent
832c3a0b83
commit
5ecb3a2e6e
5 changed files with 86 additions and 3 deletions
|
@ -19,6 +19,11 @@
|
|||
<string id="110">Name</string>
|
||||
<string id="111">Status</string>
|
||||
|
||||
<string id="112">Show:</string>
|
||||
<string id="113">All</string>
|
||||
<string id="114">Downloading</string>
|
||||
<string id="115">Seeding</string>
|
||||
|
||||
<!-- Adding / Search -->
|
||||
<string id="200">Browse for torrent file</string>
|
||||
<string id="202">Search ThePirateBay.org</string>
|
||||
|
|
|
@ -14,11 +14,16 @@
|
|||
<string id="105">Остановить все</string>
|
||||
<string id="106">Запустить все</string>
|
||||
<string id="107">Выход</string>
|
||||
<string id="108">Настойки</string>
|
||||
<string id="108">Настройки</string>
|
||||
|
||||
<string id="110">Название</string>
|
||||
<string id="111">Статус</string>
|
||||
|
||||
<string id="112">Показывать:</string>
|
||||
<string id="113">Все</string>
|
||||
<string id="114">Активные</string>
|
||||
<string id="115">Завершенные</string>
|
||||
|
||||
<!-- Adding / Search -->
|
||||
<string id="200">Выбрать торрент-файл</string>
|
||||
<string id="202">Искать на ThePirateBay.org</string>
|
||||
|
|
|
@ -30,6 +30,7 @@ class TransmissionGUI(xbmcgui.WindowXMLDialog):
|
|||
def __init__(self, strXMLname, strFallbackPath, strDefaultName, bforeFallback=0):
|
||||
self.torrents = {}
|
||||
self.timer = None
|
||||
self.filter = lambda x : True
|
||||
def get_settings(self):
|
||||
params = {
|
||||
'address': __settings__.getSetting('rpc_host'),
|
||||
|
@ -47,6 +48,9 @@ class TransmissionGUI(xbmcgui.WindowXMLDialog):
|
|||
params = self.get_settings()
|
||||
return transmissionrpc.Client(**params)
|
||||
def onInit(self):
|
||||
self.getControl(125).setSelected(True)
|
||||
self.getControl(126).setSelected(False)
|
||||
self.getControl(127).setSelected(False)
|
||||
p = xbmcgui.DialogProgress()
|
||||
p.create(_(0), _(1)) # 'Transmission', 'Connecting to Transmission'
|
||||
try:
|
||||
|
@ -81,6 +85,7 @@ class TransmissionGUI(xbmcgui.WindowXMLDialog):
|
|||
def updateTorrents(self):
|
||||
list = self.getControl(120)
|
||||
self.torrents = self.transmission.info()
|
||||
self.torrents = dict((k, v) for (k, v) in self.torrents.items() if self.filter(v))
|
||||
i = 0
|
||||
for torrentid, torrent in self.torrents.iteritems():
|
||||
statusline = "[%(status)s] %(down)s down (%(pct).2f%%), %(up)s up (Ratio: %(ratio).2f)" % \
|
||||
|
@ -205,6 +210,21 @@ class TransmissionGUI(xbmcgui.WindowXMLDialog):
|
|||
if (controlID == 120):
|
||||
# Do nothing, just select the item
|
||||
pass
|
||||
if (controlID == 125):
|
||||
# Show all torrents
|
||||
self.getControl(126).setSelected(False)
|
||||
self.getControl(127).setSelected(False)
|
||||
self.filter = lambda torrent : True
|
||||
if (controlID == 126):
|
||||
# Show only active downloads
|
||||
self.getControl(125).setSelected(False)
|
||||
self.getControl(127).setSelected(False)
|
||||
self.filter = lambda torrent : True if torrent.status != "seeding" else False
|
||||
if (controlID == 127):
|
||||
# Show finished downloads
|
||||
self.getControl(125).setSelected(False)
|
||||
self.getControl(126).setSelected(False)
|
||||
self.filter = lambda torrent : True if torrent.status == "seeding" else False
|
||||
def onDoubleClick(self, controlID):
|
||||
if (controlID == 120):
|
||||
# A torrent was chosen, show details
|
||||
|
|
|
@ -167,7 +167,7 @@
|
|||
<posx>935</posx>
|
||||
<posy>35</posy>
|
||||
<width>30</width>
|
||||
<height>500</height>
|
||||
<height>480</height>
|
||||
<visible>true</visible>
|
||||
<texturesliderbackground border="0,14,0,14">ScrollBarV.png</texturesliderbackground>
|
||||
<texturesliderbar border="0,14,0,14">ScrollBarV_bar.png</texturesliderbar>
|
||||
|
@ -183,7 +183,7 @@
|
|||
<posx>135</posx>
|
||||
<posy>35</posy>
|
||||
<width>800</width>
|
||||
<height>500</height>
|
||||
<height>480</height>
|
||||
<viewtype label="Torrent List">list</viewtype>
|
||||
<orientation>vertical</orientation>
|
||||
<visible>true</visible>
|
||||
|
@ -291,5 +291,58 @@
|
|||
<onleft>111</onleft>
|
||||
<ondown>120</ondown>
|
||||
</control>
|
||||
<control type="label">
|
||||
<posx>155</posx>
|
||||
<posy>523</posy>
|
||||
<width>60</width>
|
||||
<height>20</height>
|
||||
<font>font12</font>
|
||||
<label>SCRIPT112</label>
|
||||
</control>
|
||||
<control type="radiobutton" id="125">
|
||||
<description>Show all</description>
|
||||
<posx>240</posx>
|
||||
<posy>525</posy>
|
||||
<width>70</width>
|
||||
<height>20</height>
|
||||
<visible>true</visible>
|
||||
<colordiffuse>FFFFFFFF</colordiffuse>
|
||||
<texturefocus>button-focus_orig.png</texturefocus>
|
||||
<texturenofocus>-</texturenofocus>
|
||||
<label>SCRIPT113</label>
|
||||
<font>font12</font>
|
||||
<textcolor>FFFFFFFF</textcolor>
|
||||
<disabledcolor>80FFFFFF</disabledcolor>
|
||||
</control>
|
||||
<control type="radiobutton" id="126">
|
||||
<description>Show downloading</description>
|
||||
<posx>340</posx>
|
||||
<posy>525</posy>
|
||||
<width>150</width>
|
||||
<height>20</height>
|
||||
<visible>true</visible>
|
||||
<colordiffuse>FFFFFFFF</colordiffuse>
|
||||
<texturefocus>button-focus_orig.png</texturefocus>
|
||||
<texturenofocus>-</texturenofocus>
|
||||
<label>SCRIPT114</label>
|
||||
<font>font12</font>
|
||||
<textcolor>FFFFFFFF</textcolor>
|
||||
<disabledcolor>80FFFFFF</disabledcolor>
|
||||
</control>
|
||||
<control type="radiobutton" id="127">
|
||||
<description>Show finished</description>
|
||||
<posx>520</posx>
|
||||
<posy>525</posy>
|
||||
<width>115</width>
|
||||
<height>20</height>
|
||||
<visible>true</visible>
|
||||
<colordiffuse>FFFFFFFF</colordiffuse>
|
||||
<texturefocus>button-focus_orig.png</texturefocus>
|
||||
<texturenofocus>-</texturenofocus>
|
||||
<label>SCRIPT115</label>
|
||||
<font>font12</font>
|
||||
<textcolor>FFFFFFFF</textcolor>
|
||||
<disabledcolor>80FFFFFF</disabledcolor>
|
||||
</control>
|
||||
</controls>
|
||||
</window>
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 157 KiB After Width: | Height: | Size: 147 KiB |
Loading…
Reference in a new issue