btmon speeded up, all ICapTorrent backends clarified and fillobj cleaned

This commit is contained in:
Julien Veyssier 2013-03-15 18:20:54 +01:00
commit b907c8b266
10 changed files with 101 additions and 39 deletions

View file

@ -17,7 +17,7 @@
# You should have received a copy of the GNU Affero General Public License
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
from weboob.capabilities.torrent import ICapTorrent
from weboob.capabilities.torrent import ICapTorrent, Torrent
from weboob.tools.backend import BaseBackend
from .browser import BtmonBrowser
@ -50,3 +50,16 @@ class BtmonBackend(BaseBackend, ICapTorrent):
def iter_torrents(self, pattern):
return self.browser.iter_torrents(quote_plus(pattern.encode('utf-8')))
def fill_torrent(self, torrent, fields):
if 'description' in fields:
tor = self.get_torrent(torrent.id)
torrent.description = tor.description
torrent.magnet = tor.magnet
torrent.files = tor.files
torrent.url = tor.url
return torrent
OBJECTS = {
Torrent:fill_torrent
}