Commit 58c1f5e9 authored by echel0n's avatar echel0n

Added code to ensure seeders, leechers, and size are always integer values…

Added code to ensure seeders, leechers, and size are always integer values before being added to cache.
parent f8c4e2d4
# Changelog
- * 5061118 - 2018-11-28: Release v9.4.46
- * ff3a3bc - 2018-11-29: Added code to ensure seeders, leechers, and size are always integer values before being added to cache.
- * 80b928a - 2018-11-28: Release v9.4.46
- * e444d97 - 2018-11-26: Release v9.4.45
- * 20da5e1 - 2018-11-26: Fixed Windows unicode issue with tzlocal.
- * d07ac9d - 2018-11-25: Release v9.4.44
......
......@@ -27,7 +27,7 @@ import sickrage
from sickrage.core.api.cache import ProviderCacheAPI
from sickrage.core.common import Quality
from sickrage.core.exceptions import AuthException, EpisodeNotFoundException
from sickrage.core.helpers import findCertainShow, show_names, validate_url, is_ip_private
from sickrage.core.helpers import findCertainShow, show_names, validate_url, is_ip_private, try_int
from sickrage.core.nameparser import InvalidNameException, NameParser, InvalidShowException
from sickrage.core.websession import WebSession
......@@ -225,9 +225,9 @@ class TVCache(object):
'quality': quality,
'release_group': release_group,
'version': version,
'seeders': seeders,
'leechers': leechers,
'size': size
'seeders': try_int(seeders),
'leechers': try_int(leechers),
'size': try_int(size, -1)
}
# add to internal database
......
......@@ -167,14 +167,14 @@ def pickBestResult(results, show):
continue
# check if seeders meet out minimum requirements, disgard result if it does not
if hasattr(cur_result.provider, 'minseed') and cur_result.seeders not in (-1, None):
if hasattr(cur_result.provider, 'minseed') and cur_result.seeders not in (-1, None, ''):
if int(cur_result.seeders) < int(cur_result.provider.minseed):
sickrage.app.log.info("Discarding torrent because it doesn't meet the minimum seeders: {}. Seeders: "
"{}".format(cur_result.name, cur_result.seeders))
continue
# check if leechers meet out minimum requirements, disgard result if it does not
if hasattr(cur_result.provider, 'minleech') and cur_result.leechers not in (-1, None):
if hasattr(cur_result.provider, 'minleech') and cur_result.leechers not in (-1, None, ''):
if int(cur_result.leechers) < int(cur_result.provider.minleech):
sickrage.app.log.info("Discarding torrent because it doesn't meet the minimum leechers: {}. Leechers: "
"{}".format(cur_result.name, cur_result.leechers))
......
......@@ -111,9 +111,13 @@ class BTNProvider(TorrentProvider):
leechers = try_int(row.get('Leechers'))
size = try_int(row.get('Size'), -1)
results += [
{'title': title, 'link': download_url, 'size': size, 'seeders': seeders, 'leechers': leechers}
]
results += [{
'title': title,
'link': download_url,
'size': size,
'seeders': seeders,
'leechers': leechers
}]
sickrage.app.log.debug("Found result: {}".format(title))
......
......@@ -34,8 +34,8 @@ class DanishbitsProvider(TorrentProvider):
self.passkey = None
# Torrent Stats
self.minseed = 0
self.minleech = 0
self.minseed = None
self.minleech = None
self.freeleech = True
# URLs
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment