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