mirror of
https://github.com/moparisthebest/SickRage
synced 2024-11-15 22:05:02 -05:00
Fixed issues with per-provider torrent ratio settings, now can be left blank to default to client ratio setting.
This commit is contained in:
parent
753be64090
commit
b499e4b6db
@ -366,7 +366,13 @@ var show_nzb_providers = #if $sickbeard.USE_NZBS then "true" else "false"#;
|
|||||||
<div class="field-pair">
|
<div class="field-pair">
|
||||||
<label class="clearfix">
|
<label class="clearfix">
|
||||||
<span class="component-title" id="${curTorrentProvider.getID()}_ratio_desc">Seed Ratio:</span>
|
<span class="component-title" id="${curTorrentProvider.getID()}_ratio_desc">Seed Ratio:</span>
|
||||||
<input type="text" name="${curTorrentProvider.getID()}_ratio" id="${curTorrentProvider.getID()}_ratio" value="$curTorrentProvider.ratio" size="40" />
|
<input type="number" step="0.1" name="${curTorrentProvider.getID()}_ratio" id="${curTorrentProvider.getID()}_ratio" value="$curTorrentProvider.ratio" size="2" />
|
||||||
|
</label>
|
||||||
|
<label class="clearfix">
|
||||||
|
<span class="component-title"> </span>
|
||||||
|
<span class="component-desc">
|
||||||
|
Stop transfer when reaching ratio<br>
|
||||||
|
(blank for default)</span>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
#end if
|
#end if
|
||||||
@ -375,7 +381,7 @@ var show_nzb_providers = #if $sickbeard.USE_NZBS then "true" else "false"#;
|
|||||||
<div class="field-pair">
|
<div class="field-pair">
|
||||||
<label class="clearfix">
|
<label class="clearfix">
|
||||||
<span class="component-title" id="${curTorrentProvider.getID()}_minseed_desc">Min Seeders:</span>
|
<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" />
|
<input type="number" name="${curTorrentProvider.getID()}_minseed" id="${curTorrentProvider.getID()}_minseed" value="$curTorrentProvider.minseed" size="40" />
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
#end if
|
#end if
|
||||||
@ -384,7 +390,7 @@ var show_nzb_providers = #if $sickbeard.USE_NZBS then "true" else "false"#;
|
|||||||
<div class="field-pair">
|
<div class="field-pair">
|
||||||
<label class="clearfix">
|
<label class="clearfix">
|
||||||
<span class="component-title" id="${curTorrentProvider.getID()}_minleech_desc">Min Leechers:</span>
|
<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" />
|
<input type="number" name="${curTorrentProvider.getID()}_minleech" id="${curTorrentProvider.getID()}_minleech" value="$curTorrentProvider.minleech" size="40" />
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
#end if
|
#end if
|
||||||
|
@ -944,7 +944,8 @@ def initialize(consoleLogging=True):
|
|||||||
properFinderScheduler.silent = True
|
properFinderScheduler.silent = True
|
||||||
|
|
||||||
autoPostProcesserScheduler = scheduler.Scheduler(autoPostProcesser.PostProcesser(),
|
autoPostProcesserScheduler = scheduler.Scheduler(autoPostProcesser.PostProcesser(),
|
||||||
cycleTime=datetime.timedelta(minutes=AUTOPOSTPROCESSER_FREQUENCY),
|
cycleTime=datetime.timedelta(
|
||||||
|
minutes=AUTOPOSTPROCESSER_FREQUENCY),
|
||||||
threadName="POSTPROCESSER",
|
threadName="POSTPROCESSER",
|
||||||
runImmediately=True)
|
runImmediately=True)
|
||||||
if not PROCESS_AUTOMATICALLY:
|
if not PROCESS_AUTOMATICALLY:
|
||||||
@ -1018,8 +1019,8 @@ def initialize(consoleLogging=True):
|
|||||||
curTorrentProvider.options = check_setting_str(CFG, curTorrentProvider.getID().upper(),
|
curTorrentProvider.options = check_setting_str(CFG, curTorrentProvider.getID().upper(),
|
||||||
curTorrentProvider.getID() + '_options', '')
|
curTorrentProvider.getID() + '_options', '')
|
||||||
if hasattr(curTorrentProvider, 'ratio'):
|
if hasattr(curTorrentProvider, 'ratio'):
|
||||||
curTorrentProvider.ratio = float(check_setting_float(CFG, curTorrentProvider.getID().upper(),
|
curTorrentProvider.ratio = check_setting_str(CFG, curTorrentProvider.getID().upper(),
|
||||||
curTorrentProvider.getID() + '_ratio', 0))
|
curTorrentProvider.getID() + '_ratio', '')
|
||||||
if hasattr(curTorrentProvider, 'minseed'):
|
if hasattr(curTorrentProvider, 'minseed'):
|
||||||
curTorrentProvider.minseed = check_setting_int(CFG, curTorrentProvider.getID().upper(),
|
curTorrentProvider.minseed = check_setting_int(CFG, curTorrentProvider.getID().upper(),
|
||||||
curTorrentProvider.getID() + '_minseed', 0)
|
curTorrentProvider.getID() + '_minseed', 0)
|
||||||
@ -1436,8 +1437,8 @@ def save_config():
|
|||||||
new_config[curTorrentProvider.getID().upper()][curTorrentProvider.getID() + '_confirmed'] = int(
|
new_config[curTorrentProvider.getID().upper()][curTorrentProvider.getID() + '_confirmed'] = int(
|
||||||
curTorrentProvider.confirmed)
|
curTorrentProvider.confirmed)
|
||||||
if hasattr(curTorrentProvider, 'ratio'):
|
if hasattr(curTorrentProvider, 'ratio'):
|
||||||
new_config[curTorrentProvider.getID().upper()][curTorrentProvider.getID() + '_ratio'] = float(
|
new_config[curTorrentProvider.getID().upper()][
|
||||||
curTorrentProvider.ratio)
|
curTorrentProvider.getID() + '_ratio'] = curTorrentProvider.ratio
|
||||||
if hasattr(curTorrentProvider, 'minseed'):
|
if hasattr(curTorrentProvider, 'minseed'):
|
||||||
new_config[curTorrentProvider.getID().upper()][curTorrentProvider.getID() + '_minseed'] = int(
|
new_config[curTorrentProvider.getID().upper()][curTorrentProvider.getID() + '_minseed'] = int(
|
||||||
curTorrentProvider.minseed)
|
curTorrentProvider.minseed)
|
||||||
|
@ -164,18 +164,11 @@ class DelugeAPI(GenericClient):
|
|||||||
|
|
||||||
def _set_torrent_ratio(self, result):
|
def _set_torrent_ratio(self, result):
|
||||||
|
|
||||||
ratio = ''
|
ratio = None
|
||||||
if result.ratio:
|
if result.ratio:
|
||||||
ratio = result.ratio
|
ratio = result.ratio
|
||||||
else:
|
|
||||||
return True
|
|
||||||
|
|
||||||
try:
|
|
||||||
float(ratio)
|
|
||||||
except ValueError:
|
|
||||||
logger.log(self.name + u': Invalid Ratio. "' + ratio + u'" is not a number', logger.ERROR)
|
|
||||||
return False
|
|
||||||
|
|
||||||
|
if ratio:
|
||||||
post_data = json.dumps({"method": "core.set_torrent_stop_at_ratio",
|
post_data = json.dumps({"method": "core.set_torrent_stop_at_ratio",
|
||||||
"params": [result.hash, True],
|
"params": [result.hash, True],
|
||||||
"id": 5
|
"id": 5
|
||||||
|
@ -80,7 +80,7 @@ class TransmissionAPI(GenericClient):
|
|||||||
|
|
||||||
def _set_torrent_ratio(self, result):
|
def _set_torrent_ratio(self, result):
|
||||||
|
|
||||||
ratio = ''
|
ratio = None
|
||||||
if result.ratio:
|
if result.ratio:
|
||||||
ratio = result.ratio
|
ratio = result.ratio
|
||||||
if ratio:
|
if ratio:
|
||||||
@ -92,11 +92,9 @@ class TransmissionAPI(GenericClient):
|
|||||||
|
|
||||||
torrent_id = self._get_torrent_hash(result)
|
torrent_id = self._get_torrent_hash(result)
|
||||||
|
|
||||||
if ratio == '':
|
|
||||||
# Use global settings
|
|
||||||
ratio = None
|
|
||||||
mode = 0
|
mode = 0
|
||||||
elif float(ratio) == 0:
|
if ratio:
|
||||||
|
if float(ratio) == 0:
|
||||||
ratio = 0
|
ratio = 0
|
||||||
mode = 2
|
mode = 2
|
||||||
elif float(ratio) > 0:
|
elif float(ratio) > 0:
|
||||||
|
@ -67,19 +67,11 @@ class uTorrentAPI(GenericClient):
|
|||||||
|
|
||||||
def _set_torrent_ratio(self, result):
|
def _set_torrent_ratio(self, result):
|
||||||
|
|
||||||
ratio = ''
|
ratio = None
|
||||||
if result.ratio:
|
if result.ratio:
|
||||||
ratio = result.ratio
|
ratio = result.ratio
|
||||||
else:
|
|
||||||
return True
|
|
||||||
|
|
||||||
try:
|
if ratio:
|
||||||
float(ratio)
|
|
||||||
except ValueError:
|
|
||||||
logger.log(self.name + u': Invalid Ratio. "' + ratio + u'" is not a number', logger.ERROR)
|
|
||||||
return False
|
|
||||||
|
|
||||||
ratio = 10 * float(ratio)
|
|
||||||
params = {'action': 'setprops',
|
params = {'action': 'setprops',
|
||||||
'hash': result.hash,
|
'hash': result.hash,
|
||||||
's': 'seed_override',
|
's': 'seed_override',
|
||||||
@ -89,12 +81,14 @@ class uTorrentAPI(GenericClient):
|
|||||||
params = {'action': 'setprops',
|
params = {'action': 'setprops',
|
||||||
'hash': result.hash,
|
'hash': result.hash,
|
||||||
's': 'seed_ratio',
|
's': 'seed_ratio',
|
||||||
'v': ratio
|
'v': float(ratio) * 10
|
||||||
}
|
}
|
||||||
return self._request(params=params)
|
return self._request(params=params)
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
return True
|
||||||
|
|
||||||
def _set_torrent_seed_time(self, result):
|
def _set_torrent_seed_time(self, result):
|
||||||
|
|
||||||
if sickbeard.TORRENT_SEED_TIME:
|
if sickbeard.TORRENT_SEED_TIME:
|
||||||
|
@ -1593,9 +1593,9 @@ class ConfigProviders:
|
|||||||
|
|
||||||
if hasattr(curTorrentProvider, 'ratio'):
|
if hasattr(curTorrentProvider, 'ratio'):
|
||||||
try:
|
try:
|
||||||
curTorrentProvider.ratio = float(str(kwargs[curTorrentProvider.getID() + '_ratio']).strip())
|
curTorrentProvider.ratio = str(kwargs[curTorrentProvider.getID() + '_ratio']).strip()
|
||||||
except:
|
except:
|
||||||
curTorrentProvider.ratio = 0
|
curTorrentProvider.ratio = None
|
||||||
|
|
||||||
if hasattr(curTorrentProvider, 'digest'):
|
if hasattr(curTorrentProvider, 'digest'):
|
||||||
try:
|
try:
|
||||||
|
Loading…
Reference in New Issue
Block a user