mirror of
https://github.com/SickGear/SickGear.git
synced 2024-12-03 18:03:37 +00: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
6 changed files with 63 additions and 71 deletions
|
@ -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
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
# Sick Beard is distributed in the hope that it will be useful,
|
# Sick Beard is distributed in the hope that it will be useful,
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with Sick Beard. If not, see <http://www.gnu.org/licenses/>.
|
# along with Sick Beard. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
@ -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,14 +1019,14 @@ 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)
|
||||||
if hasattr(curTorrentProvider, 'minleech'):
|
if hasattr(curTorrentProvider, 'minleech'):
|
||||||
curTorrentProvider.minleech = check_setting_int(CFG, curTorrentProvider.getID().upper(),
|
curTorrentProvider.minleech = check_setting_int(CFG, curTorrentProvider.getID().upper(),
|
||||||
curTorrentProvider.getID() + '_minleech', 0)
|
curTorrentProvider.getID() + '_minleech', 0)
|
||||||
if hasattr(curTorrentProvider, 'freeleech'):
|
if hasattr(curTorrentProvider, 'freeleech'):
|
||||||
curTorrentProvider.freeleech = bool(check_setting_int(CFG, curTorrentProvider.getID().upper(),
|
curTorrentProvider.freeleech = bool(check_setting_int(CFG, curTorrentProvider.getID().upper(),
|
||||||
curTorrentProvider.getID() + '_freeleech', 0))
|
curTorrentProvider.getID() + '_freeleech', 0))
|
||||||
|
@ -1054,16 +1055,16 @@ def initialize(consoleLogging=True):
|
||||||
curNzbProvider.getID() + '_username', '')
|
curNzbProvider.getID() + '_username', '')
|
||||||
if hasattr(curNzbProvider, 'search_mode'):
|
if hasattr(curNzbProvider, 'search_mode'):
|
||||||
curNzbProvider.search_mode = check_setting_str(CFG, curNzbProvider.getID().upper(),
|
curNzbProvider.search_mode = check_setting_str(CFG, curNzbProvider.getID().upper(),
|
||||||
curNzbProvider.getID() + '_search_mode',
|
curNzbProvider.getID() + '_search_mode',
|
||||||
'eponly')
|
'eponly')
|
||||||
if hasattr(curNzbProvider, 'search_fallback'):
|
if hasattr(curNzbProvider, 'search_fallback'):
|
||||||
curNzbProvider.search_fallback = bool(check_setting_int(CFG, curNzbProvider.getID().upper(),
|
curNzbProvider.search_fallback = bool(check_setting_int(CFG, curNzbProvider.getID().upper(),
|
||||||
curNzbProvider.getID() + '_search_fallback',
|
curNzbProvider.getID() + '_search_fallback',
|
||||||
0))
|
0))
|
||||||
if hasattr(curNzbProvider, 'backlog_only'):
|
if hasattr(curNzbProvider, 'backlog_only'):
|
||||||
curNzbProvider.backlog_only = bool(check_setting_int(CFG, curNzbProvider.getID().upper(),
|
curNzbProvider.backlog_only = bool(check_setting_int(CFG, curNzbProvider.getID().upper(),
|
||||||
curNzbProvider.getID() + '_backlog_only',
|
curNzbProvider.getID() + '_backlog_only',
|
||||||
0))
|
0))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
url = 'http://raw.github.com/echel0n/sickrage-init/master/settings.ini'
|
url = 'http://raw.github.com/echel0n/sickrage-init/master/settings.ini'
|
||||||
|
@ -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,31 +164,24 @@ 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:
|
if ratio:
|
||||||
float(ratio)
|
post_data = json.dumps({"method": "core.set_torrent_stop_at_ratio",
|
||||||
except ValueError:
|
"params": [result.hash, True],
|
||||||
logger.log(self.name + u': Invalid Ratio. "' + ratio + u'" is not a number', logger.ERROR)
|
"id": 5
|
||||||
return False
|
})
|
||||||
|
self._request(method='post', data=post_data)
|
||||||
|
|
||||||
post_data = json.dumps({"method": "core.set_torrent_stop_at_ratio",
|
post_data = json.dumps({"method": "core.set_torrent_stop_ratio",
|
||||||
"params": [result.hash, True],
|
"params": [result.hash, float(ratio)],
|
||||||
"id": 5
|
"id": 6
|
||||||
})
|
})
|
||||||
self._request(method='post', data=post_data)
|
self._request(method='post', data=post_data)
|
||||||
|
|
||||||
post_data = json.dumps({"method": "core.set_torrent_stop_ratio",
|
return not self.response.json()['error']
|
||||||
"params": [result.hash, float(ratio)],
|
|
||||||
"id": 6
|
|
||||||
})
|
|
||||||
self._request(method='post', data=post_data)
|
|
||||||
|
|
||||||
return not self.response.json()['error']
|
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
|
@ -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,16 +92,14 @@ class TransmissionAPI(GenericClient):
|
||||||
|
|
||||||
torrent_id = self._get_torrent_hash(result)
|
torrent_id = self._get_torrent_hash(result)
|
||||||
|
|
||||||
if ratio == '':
|
mode = 0
|
||||||
# Use global settings
|
if ratio:
|
||||||
ratio = None
|
if float(ratio) == 0:
|
||||||
mode = 0
|
ratio = 0
|
||||||
elif float(ratio) == 0:
|
mode = 2
|
||||||
ratio = 0
|
elif float(ratio) > 0:
|
||||||
mode = 2
|
ratio = float(ratio)
|
||||||
elif float(ratio) > 0:
|
mode = 1 # Stop seeding at seedRatioLimit
|
||||||
ratio = float(ratio)
|
|
||||||
mode = 1 # Stop seeding at seedRatioLimit
|
|
||||||
|
|
||||||
arguments = {'ids': [torrent_id],
|
arguments = {'ids': [torrent_id],
|
||||||
'seedRatioLimit': ratio,
|
'seedRatioLimit': ratio,
|
||||||
|
|
|
@ -67,33 +67,27 @@ 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',
|
|
||||||
'hash': result.hash,
|
|
||||||
's': 'seed_override',
|
|
||||||
'v': '1'
|
|
||||||
}
|
|
||||||
if self._request(params=params):
|
|
||||||
params = {'action': 'setprops',
|
params = {'action': 'setprops',
|
||||||
'hash': result.hash,
|
'hash': result.hash,
|
||||||
's': 'seed_ratio',
|
's': 'seed_override',
|
||||||
'v': ratio
|
'v': '1'
|
||||||
}
|
}
|
||||||
return self._request(params=params)
|
if self._request(params=params):
|
||||||
else:
|
params = {'action': 'setprops',
|
||||||
return False
|
'hash': result.hash,
|
||||||
|
's': 'seed_ratio',
|
||||||
|
'v': float(ratio) * 10
|
||||||
|
}
|
||||||
|
return self._request(params=params)
|
||||||
|
else:
|
||||||
|
return False
|
||||||
|
|
||||||
|
return True
|
||||||
|
|
||||||
def _set_torrent_seed_time(self, result):
|
def _set_torrent_seed_time(self, result):
|
||||||
|
|
||||||
|
|
|
@ -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 a new issue