mirror of
https://github.com/correl/Transmission-XBMC.git
synced 2025-01-08 03:00:16 +00:00
Updated torrent list view to use progress bars
This commit is contained in:
parent
b61498cd1c
commit
db2bf3fa6c
3 changed files with 45 additions and 20 deletions
|
@ -26,6 +26,12 @@
|
|||
<string id="292">Could not connect to search site</string>
|
||||
<string id="293">Could not download torrent data</string>
|
||||
|
||||
<!-- Status -->
|
||||
<!-- Short torrent status -->
|
||||
<string id="300">working</string>
|
||||
<string id="301">seeding</string>
|
||||
<string id="302">stopped</string>
|
||||
|
||||
<!-- Settings -->
|
||||
<string id="1000">RPC Settings</string>
|
||||
<string id="1001">Host</string>
|
||||
|
|
|
@ -69,15 +69,16 @@ class TransmissionGUI(xbmcgui.WindowXMLDialog):
|
|||
self.repeater.start()
|
||||
def updateTorrents(self):
|
||||
list = self.getControl(20)
|
||||
statuses = {'stopped': _(302),
|
||||
'seeding': _(301),
|
||||
'downloading': _(300)}
|
||||
torrents = self.transmission.info()
|
||||
for i, torrent in torrents.iteritems():
|
||||
status = statuses[torrent.status]
|
||||
statusline = "[%(status)s] %(down)s down (%(pct).2f%%), %(up)s up (Ratio: %(ratio).2f)" % \
|
||||
{'down': Bytes.format(torrent.downloadedEver), 'pct': torrent.progress, \
|
||||
'up': Bytes.format(torrent.uploadedEver), 'ratio': torrent.ratio, \
|
||||
'status': torrent.status}
|
||||
if torrent.status is 'downloading':
|
||||
statusline += " ETA: %(eta)s" % \
|
||||
{'eta': torrent.eta}
|
||||
if i not in self.list:
|
||||
# Create a new list item
|
||||
l = xbmcgui.ListItem(label=torrent.name, label2=statusline)
|
||||
|
@ -89,8 +90,9 @@ class TransmissionGUI(xbmcgui.WindowXMLDialog):
|
|||
self.torrents = torrents
|
||||
l.setLabel(torrent.name)
|
||||
l.setLabel2(statusline)
|
||||
l.setProperty('TorrentStatus', status)
|
||||
l.setProperty('TorrentID', str(i))
|
||||
l.setProperty('TorrentProgress', "%.2ff" % torrent.progress)
|
||||
l.setProperty('TorrentProgress', "%.2f" % torrent.progress)
|
||||
l.setInfo('torrent', torrent.fields)
|
||||
l.setInfo('video', {'episode': int(torrent.progress)})
|
||||
|
||||
|
|
|
@ -14,8 +14,8 @@
|
|||
<width>980</width>
|
||||
<height>560</height>
|
||||
<texture>transmission-main.png</texture>
|
||||
<animation effect="fade" time="200">WindowOpen</animation>
|
||||
<animation effect="fade" time="200">WindowClose</animation>
|
||||
<animation effect="fade" time="200">WindowOpen</animation>
|
||||
<animation effect="fade" time="200">WindowClose</animation>
|
||||
</control>
|
||||
|
||||
<control type="label">
|
||||
|
@ -150,7 +150,7 @@
|
|||
<onup>16</onup>
|
||||
<texturefocus>exit-focus.png</texturefocus>
|
||||
<texturenofocus>exit-nofocus.png</texturenofocus>
|
||||
<ondown>11</ondown>
|
||||
<ondown>11</ondown>
|
||||
</control>
|
||||
</control>
|
||||
<!--
|
||||
|
@ -172,7 +172,7 @@
|
|||
<orientation>vertical</orientation>
|
||||
<visible>true</visible>
|
||||
<onleft>11</onleft>
|
||||
<onright>17</onright>
|
||||
<onright>17</onright>
|
||||
<itemlayout width="560" height="70">
|
||||
<control type="image">
|
||||
<posx>0</posx>
|
||||
|
@ -184,16 +184,25 @@
|
|||
<control type="label">
|
||||
<posx>10</posx>
|
||||
<posy>0</posy>
|
||||
<width>790</width>
|
||||
<width>110</width>
|
||||
<height>20</height>
|
||||
<info>ListItem.label</info>
|
||||
<label>[$INFO[ListItem.Property(TorrentStatus)]]</label>
|
||||
<scroll>true</scroll>
|
||||
</control>
|
||||
<control type="label">
|
||||
<posx>15</posx>
|
||||
<posy>20</posy>
|
||||
<width>785</width>
|
||||
<posx>120</posx>
|
||||
<posy>0</posy>
|
||||
<width>680</width>
|
||||
<height>20</height>
|
||||
<info>ListItem.label2</info>
|
||||
<label>$INFO[ListItem.label]</label>
|
||||
<scroll>true</scroll>
|
||||
</control>
|
||||
<control type="progress">
|
||||
<posx>10</posx>
|
||||
<posy>40</posy>
|
||||
<width>790</width>
|
||||
<height>20</height>
|
||||
<info>ListItem.Property(TorrentProgress)</info>
|
||||
</control>
|
||||
</itemlayout>
|
||||
<focusedlayout width="560" height="70">
|
||||
|
@ -216,17 +225,25 @@
|
|||
<control type="label">
|
||||
<posx>10</posx>
|
||||
<posy>0</posy>
|
||||
<width>870</width>
|
||||
<width>110</width>
|
||||
<height>20</height>
|
||||
<info>ListItem.label</info>
|
||||
<label>[$INFO[ListItem.Property(TorrentStatus)]]</label>
|
||||
<scroll>true</scroll>
|
||||
</control>
|
||||
<control type="label">
|
||||
<posx>15</posx>
|
||||
<posy>20</posy>
|
||||
<width>885</width>
|
||||
<posx>120</posx>
|
||||
<posy>0</posy>
|
||||
<width>680</width>
|
||||
<height>20</height>
|
||||
<info>ListItem.label2</info>
|
||||
<label>$INFO[ListItem.label]</label>
|
||||
<scroll>true</scroll>
|
||||
</control>
|
||||
<control type="progress">
|
||||
<posx>10</posx>
|
||||
<posy>40</posy>
|
||||
<width>790</width>
|
||||
<height>20</height>
|
||||
<info>ListItem.Property(TorrentProgress)</info>
|
||||
</control>
|
||||
</focusedlayout>
|
||||
</control>
|
||||
|
|
Loading…
Reference in a new issue