Save size in bytes and compute & save human_size.

This commit is contained in:
2021-07-03 18:40:13 +02:00
parent 2112147e3c
commit bd91939121
2 changed files with 6 additions and 6 deletions

View File

@@ -8,7 +8,6 @@ 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')
@@ -89,7 +88,7 @@ class Jackett(object):
title = self.find_xml_attribute(child, 'title')
date = self.find_xml_attribute(child, 'pubDate')
magnet = self.find_xml_attribute(child, 'link')
size = self.find_xml_attribute(child, 'size')
size = self.find_xml_attribute(child, 'size')
files = self.find_xml_attribute(child, 'files')
foundUploader = re.findall('-1? *\w*', title)
if len(foundUploader) > 0:
@@ -105,9 +104,6 @@ class Jackett(object):
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))
torrent = Torrent(title, magnet=magnet, size=size, uploader=uploader, date=date, seed_count=seeders, leech_count=peers)