From abb7fb7f3fdd9e39623cd5b4c4bc4d10566c02cc Mon Sep 17 00:00:00 2001 From: Phil Borman Date: Fri, 10 Aug 2018 18:46:07 +0200 Subject: [PATCH] Fix for some pirate proxy addresses --- lazylibrarian/torrentparser.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lazylibrarian/torrentparser.py b/lazylibrarian/torrentparser.py index 32e77eb5d..c525a2504 100644 --- a/lazylibrarian/torrentparser.py +++ b/lazylibrarian/torrentparser.py @@ -110,9 +110,13 @@ def TPB(book=None, test=False): except ValueError: seeders = 0 + # no point in asking for magnet link if not enough seeders if minimumseeders < seeders: - # no point in asking for magnet link if not enough seeders - magurl = '%s/%s' % (host, magnet) + # some tpb proxies return absolute path, some return relative + if magnet.startswith('http'): + magurl = magnet + else: + magurl = '%s/%s' % (host, magnet) result, success = fetchURL(magurl) if not success: logger.debug('Error fetching url %s, %s' % (magurl, result)) @@ -136,7 +140,7 @@ def TPB(book=None, test=False): 'tor_type': 'magnet', 'priority': lazylibrarian.CONFIG['TPB_DLPRIORITY'] }) - logger.debug('Found %s. Size: %s' % (title, size)) + logger.debug('Found %s. Size: %s: %s' % (title, size, magnet)) next_page = True else: logger.debug('Found %s but %s seeder%s' % (title, seeders, plural(seeders)))