From 3a5a414e63a9e0adee4187d27ee0f60ff6d94208 Mon Sep 17 00:00:00 2001 From: Florent Date: Fri, 2 Aug 2013 12:58:52 +0200 Subject: [PATCH] Catch empty seeders and leechers --- weboob/applications/weboorrents/weboorrents.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/weboob/applications/weboorrents/weboorrents.py b/weboob/applications/weboorrents/weboorrents.py index 9ead91e8..ce00f4cd 100644 --- a/weboob/applications/weboorrents/weboorrents.py +++ b/weboob/applications/weboorrents/weboorrents.py @@ -25,7 +25,7 @@ from weboob.capabilities.torrent import ICapTorrent, MagnetOnly from weboob.tools.application.repl import ReplApplication, defaultcount from weboob.tools.application.formatters.iformatter import IFormatter, PrettyFormatter from weboob.core import CallErrors -from weboob.capabilities.base import NotAvailable +from weboob.capabilities.base import NotAvailable, empty __all__ = ['Weboorrents'] @@ -68,7 +68,10 @@ class TorrentListFormatter(PrettyFormatter): def get_description(self, obj): size = sizeof_fmt(obj.size) - return '%10s (Seed: %2d / Leech: %2d)' % (size, obj.seeders, obj.leechers) + if not empty(obj.seeders) and not empty(obj.leechers): + return '%10s (Seed: %2d / Leech: %2d)' % (size, obj.seeders, obj.leechers) + else: + return '%10s (Seed and Leech not available)' % size class Weboorrents(ReplApplication):