mirror of
https://github.com/correl/Transmission-XBMC.git
synced 2024-11-22 03:00:15 +00:00
Merge branch 'eden-pre'
This commit is contained in:
commit
f343b85d3f
8 changed files with 99 additions and 76 deletions
|
@ -4,7 +4,7 @@
|
|||
version="0.6.2"
|
||||
provider-name="Correl Roush">
|
||||
<requires>
|
||||
<import addon="xbmc.python" version="1.0"/>
|
||||
<import addon="xbmc.python" version="2.0"/>
|
||||
<import addon="script.module.simplejson" version="2.0.9"/>
|
||||
<import addon="script.module.beautifulsoup" version="3.0.8" />
|
||||
</requires>
|
||||
|
|
|
@ -3,6 +3,9 @@ Version 0.6.2
|
|||
Version 0.6.1
|
||||
* Add torrent button now supports various search sites as well as adding
|
||||
locally downloaded .torrent files
|
||||
* Updated to support XBMC Eden
|
||||
* Added progress bars to the torrent list screen
|
||||
* Added status icons to the torrent list screen
|
||||
Version 0.6.0
|
||||
* Added icons to buttons (submitted by aivs@yandex.ru)
|
||||
* Added Russian language support (submitted by aivs@yandex.ru)
|
||||
|
|
12
default.py
12
default.py
|
@ -2,9 +2,10 @@
|
|||
# Copyright (c) 2010 Correl J. Roush
|
||||
|
||||
import os
|
||||
import sys
|
||||
import xbmc
|
||||
import xbmcgui
|
||||
import xbmcaddon
|
||||
|
||||
__scriptname__ = "Transmission-XBMC"
|
||||
__author__ = "Correl Roush <correl@gmail.com>"
|
||||
__url__ = "http://github.com/correl/Transmission-XBMC"
|
||||
|
@ -13,18 +14,17 @@ __credits__ = ""
|
|||
__version__ = "0.5.2"
|
||||
__XBMC_Revision__ = "30377"
|
||||
|
||||
BASE_RESOURCE_PATH = xbmc.translatePath( os.path.join( os.getcwd(), 'resources', 'lib' ) )
|
||||
sys.path.append (BASE_RESOURCE_PATH)
|
||||
|
||||
__settings__ = xbmcaddon.Addon(id='script.transmission')
|
||||
|
||||
__language__ = __settings__.getLocalizedString
|
||||
|
||||
BASE_RESOURCE_PATH = xbmc.translatePath( os.path.join( __settings__.getAddonInfo('path'), 'resources', 'lib' ) )
|
||||
sys.path.append (BASE_RESOURCE_PATH)
|
||||
|
||||
KEY_BUTTON_BACK = 275
|
||||
KEY_KEYBOARD_ESC = 61467
|
||||
|
||||
if __name__ == '__main__':
|
||||
from gui import TransmissionGUI
|
||||
w = TransmissionGUI("script-Transmission-main.xml",os.getcwd() ,"Default")
|
||||
w = TransmissionGUI("script-Transmission-main.xml", __settings__.getAddonInfo('path') , "Default")
|
||||
w.doModal()
|
||||
del w
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2010 Correl J. Roush
|
||||
|
||||
import os
|
||||
import sys
|
||||
import base64
|
||||
import urllib2
|
||||
|
@ -68,16 +67,13 @@ class TransmissionGUI(xbmcgui.WindowXMLDialog):
|
|||
self.repeater = Repeater(1.0, self.updateTorrents)
|
||||
self.repeater.start()
|
||||
def updateTorrents(self):
|
||||
list = self.getControl(20)
|
||||
list = self.getControl(120)
|
||||
torrents = self.transmission.info()
|
||||
for i, torrent in torrents.iteritems():
|
||||
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)
|
||||
|
@ -87,10 +83,14 @@ class TransmissionGUI(xbmcgui.WindowXMLDialog):
|
|||
# Update existing list item
|
||||
l = self.list[i]
|
||||
self.torrents = torrents
|
||||
statusicons = {'stopped': 'pause.png',
|
||||
'seeding': 'ok.png',
|
||||
'downloading': 'down.png'}
|
||||
l.setLabel(torrent.name)
|
||||
l.setLabel2(statusline)
|
||||
l.setProperty('TorrentStatusIcon', statusicons[torrent.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)})
|
||||
|
||||
|
@ -105,8 +105,8 @@ class TransmissionGUI(xbmcgui.WindowXMLDialog):
|
|||
list.setEnabled(bool(torrents))
|
||||
|
||||
def onClick(self, controlID):
|
||||
list = self.getControl(20)
|
||||
if (controlID == 11):
|
||||
list = self.getControl(120)
|
||||
if (controlID == 111):
|
||||
# Add torrent
|
||||
engines = [
|
||||
(_(200), None),
|
||||
|
@ -155,35 +155,35 @@ class TransmissionGUI(xbmcgui.WindowXMLDialog):
|
|||
except:
|
||||
xbmcgui.Dialog().ok(_(0), _(293))
|
||||
return
|
||||
if (controlID == 12):
|
||||
if (controlID == 112):
|
||||
# Remove selected torrent
|
||||
item = list.getSelectedItem()
|
||||
if item and xbmcgui.Dialog().yesno(_(0), 'Remove \'%s\'?' % self.torrents[int(item.getProperty('TorrentID'))].name):
|
||||
remove_data = xbmcgui.Dialog().yesno(_(0), 'Remove data as well?')
|
||||
self.transmission.remove(int(item.getProperty('TorrentID')), remove_data)
|
||||
if (controlID == 13):
|
||||
if (controlID == 113):
|
||||
# Stop selected torrent
|
||||
item = list.getSelectedItem()
|
||||
if item:
|
||||
self.transmission.stop(int(item.getProperty('TorrentID')))
|
||||
if (controlID == 14):
|
||||
if (controlID == 114):
|
||||
# Start selected torrent
|
||||
item = list.getSelectedItem()
|
||||
if item:
|
||||
self.transmission.start(int(item.getProperty('TorrentID')))
|
||||
if (controlID == 15):
|
||||
if (controlID == 115):
|
||||
# Stop all torrents
|
||||
self.transmission.stop(self.torrents.keys())
|
||||
if (controlID == 16):
|
||||
if (controlID == 116):
|
||||
# Start all torrents
|
||||
self.transmission.start(self.torrents.keys())
|
||||
if (controlID == 17):
|
||||
if (controlID == 117):
|
||||
# Exit button
|
||||
self.close()
|
||||
if (controlID == 20):
|
||||
if (controlID == 120):
|
||||
# A torrent was chosen, show details
|
||||
item = list.getSelectedItem()
|
||||
w = TorrentInfoGUI("script-Transmission-details.xml",os.getcwd() ,"Default")
|
||||
w = TorrentInfoGUI("script-Transmission-details.xml", __settings__.getAddonInfo('path') ,"Default")
|
||||
w.setTorrent(self.transmission, int(item.getProperty('TorrentID')))
|
||||
w.doModal()
|
||||
del w
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<window>
|
||||
<defaultcontrol always="true">11</defaultcontrol>
|
||||
<defaultcontrol always="true">111</defaultcontrol>
|
||||
<allowoverlays>false</allowoverlays>
|
||||
<coordinates>
|
||||
<system>1</system>
|
||||
|
@ -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">
|
||||
|
@ -33,7 +33,7 @@
|
|||
<posx>0</posx>
|
||||
<posy>10</posy>
|
||||
<!-- Button Group -->
|
||||
<control type="button" id="11">
|
||||
<control type="button" id="111">
|
||||
<description>Add torrent</description>
|
||||
<posx>0</posx>
|
||||
<posy>0</posy>
|
||||
|
@ -44,13 +44,13 @@
|
|||
<textoffsety>45</textoffsety>
|
||||
<label>SCRIPT101</label>
|
||||
<font>font12_title</font>
|
||||
<onright>20</onright>
|
||||
<ondown>12</ondown>
|
||||
<onup>17</onup>
|
||||
<onright>120</onright>
|
||||
<ondown>112</ondown>
|
||||
<onup>117</onup>
|
||||
<texturefocus>add-focus.png</texturefocus>
|
||||
<texturenofocus>add-nofocus.png</texturenofocus>
|
||||
</control>
|
||||
<control type="button" id="12">
|
||||
<control type="button" id="112">
|
||||
<description>Remove torrent</description>
|
||||
<posx>0</posx>
|
||||
<posy>75</posy>
|
||||
|
@ -61,13 +61,13 @@
|
|||
<textoffsety>45</textoffsety>
|
||||
<label>SCRIPT102</label>
|
||||
<font>font12_title</font>
|
||||
<onright>20</onright>
|
||||
<onup>11</onup>
|
||||
<ondown>13</ondown>
|
||||
<onright>120</onright>
|
||||
<onup>111</onup>
|
||||
<ondown>113</ondown>
|
||||
<texturefocus>remove-focus.png</texturefocus>
|
||||
<texturenofocus>remove-nofocus.png</texturenofocus>
|
||||
</control>
|
||||
<control type="button" id="13">
|
||||
<control type="button" id="113">
|
||||
<description>Stop torrent</description>
|
||||
<posx>0</posx>
|
||||
<posy>150</posy>
|
||||
|
@ -78,13 +78,13 @@
|
|||
<textoffsety>45</textoffsety>
|
||||
<label>SCRIPT103</label>
|
||||
<font>font12_title</font>
|
||||
<onright>20</onright>
|
||||
<onup>12</onup>
|
||||
<ondown>14</ondown>
|
||||
<onright>120</onright>
|
||||
<onup>112</onup>
|
||||
<ondown>114</ondown>
|
||||
<texturefocus>stop-focus.png</texturefocus>
|
||||
<texturenofocus>stop-nofocus.png</texturenofocus>
|
||||
</control>
|
||||
<control type="button" id="14">
|
||||
<control type="button" id="114">
|
||||
<description>Start torrent</description>
|
||||
<posx>0</posx>
|
||||
<posy>225</posy>
|
||||
|
@ -95,13 +95,13 @@
|
|||
<textoffsety>45</textoffsety>
|
||||
<label>SCRIPT104</label>
|
||||
<font>font12_title</font>
|
||||
<onright>20</onright>
|
||||
<onup>13</onup>
|
||||
<ondown>15</ondown>
|
||||
<onright>120</onright>
|
||||
<onup>113</onup>
|
||||
<ondown>115</ondown>
|
||||
<texturefocus>start-focus.png</texturefocus>
|
||||
<texturenofocus>start-nofocus.png</texturenofocus>
|
||||
</control>
|
||||
<control type="button" id="15">
|
||||
<control type="button" id="115">
|
||||
<description>Stop all torrents</description>
|
||||
<posx>0</posx>
|
||||
<posy>300</posy>
|
||||
|
@ -112,13 +112,13 @@
|
|||
<textoffsety>45</textoffsety>
|
||||
<label>SCRIPT105</label>
|
||||
<font>font12_title</font>
|
||||
<onright>20</onright>
|
||||
<onup>14</onup>
|
||||
<ondown>16</ondown>
|
||||
<onright>120</onright>
|
||||
<onup>114</onup>
|
||||
<ondown>116</ondown>
|
||||
<texturefocus>stopall-focus.png</texturefocus>
|
||||
<texturenofocus>stopall-nofocus.png</texturenofocus>
|
||||
</control>
|
||||
<control type="button" id="16">
|
||||
<control type="button" id="116">
|
||||
<description>Start all torrents</description>
|
||||
<posx>0</posx>
|
||||
<posy>375 </posy>
|
||||
|
@ -129,13 +129,13 @@
|
|||
<textoffsety>45</textoffsety>
|
||||
<label>SCRIPT106</label>
|
||||
<font>font12_title</font>
|
||||
<onright>20</onright>
|
||||
<onup>15</onup>
|
||||
<ondown>17</ondown>
|
||||
<onright>120</onright>
|
||||
<onup>115</onup>
|
||||
<ondown>117</ondown>
|
||||
<texturefocus>startall-focus.png</texturefocus>
|
||||
<texturenofocus>startall-nofocus.png</texturenofocus>
|
||||
</control>
|
||||
<control type="button" id="17">
|
||||
<control type="button" id="117">
|
||||
<description>Exit</description>
|
||||
<posx>0</posx>
|
||||
<posy>450</posy>
|
||||
|
@ -146,11 +146,11 @@
|
|||
<textoffsety>45</textoffsety>
|
||||
<label>SCRIPT107</label>
|
||||
<font>font12_title</font>
|
||||
<onright>20</onright>
|
||||
<onup>16</onup>
|
||||
<onright>120</onright>
|
||||
<onup>116</onup>
|
||||
<texturefocus>exit-focus.png</texturefocus>
|
||||
<texturenofocus>exit-nofocus.png</texturenofocus>
|
||||
<ondown>11</ondown>
|
||||
<ondown>111</ondown>
|
||||
</control>
|
||||
</control>
|
||||
<!--
|
||||
|
@ -162,7 +162,7 @@
|
|||
<texture>blue.png</texture>
|
||||
</control>
|
||||
-->
|
||||
<control type="list" id="20">
|
||||
<control type="list" id="120">
|
||||
<description>Torrent list</description>
|
||||
<posx>135</posx>
|
||||
<posy>35</posy>
|
||||
|
@ -171,8 +171,8 @@
|
|||
<viewtype label="Torrent List">list</viewtype>
|
||||
<orientation>vertical</orientation>
|
||||
<visible>true</visible>
|
||||
<onleft>11</onleft>
|
||||
<onright>17</onright>
|
||||
<onleft>111</onleft>
|
||||
<onright>117</onright>
|
||||
<itemlayout width="560" height="70">
|
||||
<control type="image">
|
||||
<posx>0</posx>
|
||||
|
@ -181,19 +181,26 @@
|
|||
<height>70</height>
|
||||
<texture>list-bg.png</texture>
|
||||
</control>
|
||||
<control type="label">
|
||||
<control type="image">
|
||||
<posx>10</posx>
|
||||
<posy>0</posy>
|
||||
<width>790</width>
|
||||
<height>20</height>
|
||||
<info>ListItem.label</info>
|
||||
<width>64</width>
|
||||
<height>64</height>
|
||||
<texture>icons/$INFO[ListItem.Property(TorrentStatusIcon)]</texture>
|
||||
</control>
|
||||
<control type="label">
|
||||
<posx>15</posx>
|
||||
<posy>20</posy>
|
||||
<width>785</width>
|
||||
<posx>90</posx>
|
||||
<posy>0</posy>
|
||||
<width>700</width>
|
||||
<height>20</height>
|
||||
<info>ListItem.label2</info>
|
||||
<label>$INFO[ListItem.label]</label>
|
||||
</control>
|
||||
<control type="progress">
|
||||
<posx>90</posx>
|
||||
<posy>40</posy>
|
||||
<width>700</width>
|
||||
<height>20</height>
|
||||
<info>ListItem.Property(TorrentProgress)</info>
|
||||
</control>
|
||||
</itemlayout>
|
||||
<focusedlayout width="560" height="70">
|
||||
|
@ -202,7 +209,7 @@
|
|||
<posy>0</posy>
|
||||
<width>800</width>
|
||||
<height>70</height>
|
||||
<visible>Control.HasFocus(20)</visible>
|
||||
<visible>Control.HasFocus(120)</visible>
|
||||
<texture border="5">list-bg-selected.png</texture>
|
||||
</control>
|
||||
<control type="image">
|
||||
|
@ -210,23 +217,30 @@
|
|||
<posy>0</posy>
|
||||
<width>800</width>
|
||||
<height>70</height>
|
||||
<visible>!Control.HasFocus(20)</visible>
|
||||
<visible>!Control.HasFocus(120)</visible>
|
||||
<texture border="5">list-bg-selected-nofocus.png</texture>
|
||||
</control>
|
||||
<control type="label">
|
||||
<control type="image">
|
||||
<posx>10</posx>
|
||||
<posy>0</posy>
|
||||
<width>870</width>
|
||||
<height>20</height>
|
||||
<info>ListItem.label</info>
|
||||
<scroll>true</scroll>
|
||||
<width>64</width>
|
||||
<height>64</height>
|
||||
<texture>icons/$INFO[ListItem.Property(TorrentStatusIcon)]</texture>
|
||||
</control>
|
||||
<control type="label">
|
||||
<posx>15</posx>
|
||||
<posy>20</posy>
|
||||
<width>885</width>
|
||||
<posx>90</posx>
|
||||
<posy>0</posy>
|
||||
<width>700</width>
|
||||
<height>20</height>
|
||||
<info>ListItem.label2</info>
|
||||
<label>$INFO[ListItem.label]</label>
|
||||
<scroll>true</scroll>
|
||||
</control>
|
||||
<control type="progress">
|
||||
<posx>90</posx>
|
||||
<posy>40</posy>
|
||||
<width>700</width>
|
||||
<height>20</height>
|
||||
<info>ListItem.Property(TorrentProgress)</info>
|
||||
</control>
|
||||
</focusedlayout>
|
||||
</control>
|
||||
|
|
BIN
resources/skins/Default/media/icons/down.png
Normal file
BIN
resources/skins/Default/media/icons/down.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.1 KiB |
BIN
resources/skins/Default/media/icons/ok.png
Normal file
BIN
resources/skins/Default/media/icons/ok.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6 KiB |
Loading…
Reference in a new issue