Catch empty seeders and leechers
This commit is contained in:
parent
b058ef785e
commit
3a5a414e63
1 changed files with 5 additions and 2 deletions
|
|
@ -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):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue