From a9f51551bebd827b816b5064df63b6e1a95167c3 Mon Sep 17 00:00:00 2001 From: Kevin Midboe Date: Mon, 30 May 2022 20:02:21 +0200 Subject: [PATCH] Convert size to human readable size using imported utils funcs --- torrentSearch/jackett.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/torrentSearch/jackett.py b/torrentSearch/jackett.py index 9738693..ffadd09 100644 --- a/torrentSearch/jackett.py +++ b/torrentSearch/jackett.py @@ -8,6 +8,7 @@ from xml.etree.ElementTree import fromstring from http_utils import build_url, fetch_url from torrent import Torrent +from utils import humansize, representsInteger logger = logging.getLogger('torrentSearch') @@ -103,6 +104,8 @@ class Jackett(object): seeders = elm.get('value') if elm.get('name') == 'peers': peers = elm.get('value') + if size != '' and representsInteger(size): + size = humansize(int(size)) logger.debug('Found torrent with info: \n\ttitle: {}\n\tmagnet: {}\n\tsize: {}\n\tdate: {}\ \n\tseeders: {}\n\tpeers: {}'.format(title, magnet, size, date, seeders, peers))