Added in min seed and min leech options for torrent providers

This commit is contained in:
echel0n 2014-05-20 09:06:11 -07:00
parent a15db1719d
commit 9e1402057a
11 changed files with 70 additions and 12 deletions

View file

@ -371,6 +371,24 @@ var show_nzb_providers = #if $sickbeard.USE_NZBS then "true" else "false"#;
</div>
#end if
#if $hasattr($curTorrentProvider, 'minseed'):
<div class="field-pair">
<label class="clearfix">
<span class="component-title" id="${curTorrentProvider.getID()}_minseed_desc">Min Seeders:</span>
<input type="text" name="${curTorrentProvider.getID()}_minseed" id="${curTorrentProvider.getID()}_minseed" value="$curTorrentProvider.minseed" size="40" />
</label>
</div>
#end if
#if $hasattr($curTorrentProvider, 'minleech'):
<div class="field-pair">
<label class="clearfix">
<span class="component-title" id="${curTorrentProvider.getID()}_minleech_desc">Min Leechers:</span>
<input type="text" name="${curTorrentProvider.getID()}_minleech" id="${curTorrentProvider.getID()}_minleech" value="$curTorrentProvider.minleech" size="40" />
</label>
</div>
#end if
#if $hasattr($curTorrentProvider, 'proxy'):
<div class="field-pair">
<input type="checkbox" class="enabler" name="${curTorrentProvider.getID()}_proxy" id="${curTorrentProvider.getID()}_proxy" #if $curTorrentProvider.proxy.enabled then "checked=\"checked\"" else ""#/>

View file

@ -1012,6 +1012,12 @@ def initialize(consoleLogging=True):
if hasattr(curTorrentProvider, 'ratio'):
curTorrentProvider.ratio = float(check_setting_float(CFG, curTorrentProvider.getID().upper(),
curTorrentProvider.getID() + '_ratio', 0))
if hasattr(curTorrentProvider, 'minseed'):
curTorrentProvider.minseed = check_setting_int(CFG, curTorrentProvider.getID().upper(),
curTorrentProvider.getID() + '_minseed', 0)
if hasattr(curTorrentProvider, 'minleech'):
curTorrentProvider.minleech = check_setting_int(CFG, curTorrentProvider.getID().upper(),
curTorrentProvider.getID() + '_minleech', 0)
if hasattr(curTorrentProvider, 'freeleech'):
curTorrentProvider.freeleech = bool(check_setting_int(CFG, curTorrentProvider.getID().upper(),
curTorrentProvider.getID() + '_freeleech', 0))
@ -1422,6 +1428,12 @@ def save_config():
if hasattr(curTorrentProvider, 'ratio'):
new_config[curTorrentProvider.getID().upper()][curTorrentProvider.getID() + '_ratio'] = float(
curTorrentProvider.ratio)
if hasattr(curTorrentProvider, 'minseed'):
new_config[curTorrentProvider.getID().upper()][curTorrentProvider.getID() + '_minseed'] = int(
curTorrentProvider.minseed)
if hasattr(curTorrentProvider, 'minleech'):
new_config[curTorrentProvider.getID().upper()][curTorrentProvider.getID() + '_minleech'] = int(
curTorrentProvider.minleech)
if hasattr(curTorrentProvider, 'options'):
new_config[curTorrentProvider.getID().upper()][
curTorrentProvider.getID() + '_options'] = curTorrentProvider.options

View file

@ -62,6 +62,8 @@ class HDTorrentsProvider(generic.TorrentProvider):
self.username = None
self.password = None
self.ratio = None
self.minseed = None
self.minleech = None
self.cache = HDTorrentsCache(self)
@ -209,7 +211,7 @@ class HDTorrentsProvider(generic.TorrentProvider):
except (AttributeError, TypeError):
continue
if mode != 'RSS' and seeders == 0:
if mode != 'RSS' and (seeders == 0 or seeders < self.minseed or leechers < self.minleech):
continue
if not title or not download_url:
@ -248,7 +250,7 @@ class HDTorrentsProvider(generic.TorrentProvider):
except (AttributeError, TypeError):
continue
if mode != 'RSS' and seeders == 0:
if mode != 'RSS' and (seeders == 0 or seeders < self.minseed or leechers < self.minleech):
continue
if not title or not download_url:

View file

@ -59,6 +59,8 @@ class KATProvider(generic.TorrentProvider):
self.enabled = False
self.confirmed = False
self.ratio = None
self.minseed = None
self.minleech = None
self.cache = KATCache(self)
@ -262,7 +264,7 @@ class KATProvider(generic.TorrentProvider):
except (AttributeError, TypeError):
continue
if mode != 'RSS' and seeders == 0:
if mode != 'RSS' and (seeders == 0 or seeders < self.minseed or leechers < self.minleech):
continue
if self.confirmed and not verified:

View file

@ -56,6 +56,8 @@ class PublicHDProvider(generic.TorrentProvider):
self.enabled = False
self.ratio = None
self.minseed = None
self.minleech = None
self.cache = PublicHDCache(self)
@ -173,7 +175,7 @@ class PublicHDProvider(generic.TorrentProvider):
except (AttributeError, TypeError):
continue
if mode != 'RSS' and seeders == 0:
if mode != 'RSS' and (seeders == 0 or seeders < self.minseed or leechers < self.minleech):
continue
if not title or not url:

View file

@ -62,6 +62,8 @@ class SCCProvider(generic.TorrentProvider):
self.username = None
self.password = None
self.ratio = None
self.minseed = None
self.minleech = None
self.cache = SCCCache(self)
@ -224,7 +226,7 @@ class SCCProvider(generic.TorrentProvider):
except (AttributeError, TypeError):
continue
if mode != 'RSS' and seeders == 0:
if mode != 'RSS' and (seeders == 0 or seeders < self.minseed or leechers < self.minleech):
continue
if not title or not download_url:

View file

@ -57,6 +57,8 @@ class SpeedCDProvider(generic.TorrentProvider):
self.password = None
self.ratio = None
self.freeleech = False
self.minseed = None
self.minleech = None
self.cache = SpeedCDCache(self)
@ -169,7 +171,7 @@ class SpeedCDProvider(generic.TorrentProvider):
seeders = int(torrent['seed'])
leechers = int(torrent['leech'])
if mode != 'RSS' and seeders == 0:
if mode != 'RSS' and (seeders == 0 or seeders < self.minseed or leechers < self.minleech):
continue
if not title or not url:

View file

@ -54,6 +54,8 @@ class ThePirateBayProvider(generic.TorrentProvider):
self.enabled = False
self.ratio = None
self.confirmed = False
self.minseed = None
self.minleech = None
self.cache = ThePirateBayCache(self)
@ -245,7 +247,7 @@ class ThePirateBayProvider(generic.TorrentProvider):
leechers = int(torrent.group('leechers'))
#Filter unseeded torrent
if mode != 'RSS' and seeders == 0:
if mode != 'RSS' and (seeders == 0 or seeders < self.minseed or leechers < self.minleech):
continue
#Accept Torrent only from Good People for every Episode Search

View file

@ -60,6 +60,8 @@ class TorrentDayProvider(generic.TorrentProvider):
self.password = None
self.ratio = None
self.freeleech = False
self.minseed = None
self.minleech = None
self.cache = TorrentDayCache(self)
@ -204,7 +206,7 @@ class TorrentDayProvider(generic.TorrentProvider):
seeders = int(torrent['seed'])
leechers = int(torrent['leech'])
if mode != 'RSS' and seeders == 0:
if mode != 'RSS' and (seeders == 0 or seeders < self.minseed or leechers < self.minleech):
continue
if not title or not url:

View file

@ -58,6 +58,8 @@ class TorrentLeechProvider(generic.TorrentProvider):
self.username = None
self.password = None
self.ratio = None
self.minseed = None
self.minleech = None
self.cache = TorrentLeechCache(self)
@ -189,7 +191,7 @@ class TorrentLeechProvider(generic.TorrentProvider):
continue
#Filter unseeded torrent
if mode != 'RSS' and seeders == 0:
if mode != 'RSS' and (seeders == 0 or seeders < self.minseed or leechers < self.minleech):
continue
if not title or not download_url:

View file

@ -1006,11 +1006,11 @@ class ConfigGeneral:
@cherrypy.expose
def saveGeneral(self, log_dir=None, web_port=None, web_log=None, encryption_version=None, web_ipv6=None,
update_shows_on_start=None, update_frequency=None, launch_browser=None, web_username=None, use_api=None, api_key=None,
update_shows_on_start=None, update_frequency=None, launch_browser=None, web_username=None,
use_api=None, api_key=None,indexer_default=None, timezone_display=None, cpu_preset=None,
web_password=None, version_notify=None, enable_https=None, https_cert=None, https_key=None,
handle_reverse_proxy=None, sort_article=None, auto_update=None, proxy_setting=None,
anon_redirect=None, git_path=None, calendar_unprotected=None, date_preset=None, time_preset=None,
indexer_default=None, timezone_display=None, cpu_preset=None):
anon_redirect=None, git_path=None, calendar_unprotected=None, date_preset=None, time_preset=None):
results = []
@ -1574,6 +1574,18 @@ class ConfigProviders:
for curTorrentProvider in [curProvider for curProvider in sickbeard.providers.sortedProviderList() if
curProvider.providerType == sickbeard.GenericProvider.TORRENT]:
if hasattr(curTorrentProvider, 'minseed'):
try:
curTorrentProvider.minseed = int(str(kwargs[curTorrentProvider.getID() + '_minseed']).strip())
except:
curTorrentProvider.minseed = 0
if hasattr(curTorrentProvider, 'minleech'):
try:
curTorrentProvider.minleech = int(str(kwargs[curTorrentProvider.getID() + '_minleech']).strip())
except:
curTorrentProvider.minleech = 0
if hasattr(curTorrentProvider, 'ratio'):
try:
curTorrentProvider.ratio = float(str(kwargs[curTorrentProvider.getID() + '_ratio']).strip())