mirror of
https://github.com/SickGear/SickGear.git
synced 2024-12-03 01:43: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">
|
||||
<label class="clearfix">
|
||||
<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>
|
||||
</div>
|
||||
#end if
|
||||
|
@ -375,7 +381,7 @@ var show_nzb_providers = #if $sickbeard.USE_NZBS then "true" else "false"#;
|
|||
<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" />
|
||||
<input type="number" name="${curTorrentProvider.getID()}_minseed" id="${curTorrentProvider.getID()}_minseed" value="$curTorrentProvider.minseed" size="40" />
|
||||
</label>
|
||||
</div>
|
||||
#end if
|
||||
|
@ -384,7 +390,7 @@ var show_nzb_providers = #if $sickbeard.USE_NZBS then "true" else "false"#;
|
|||
<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" />
|
||||
<input type="number" name="${curTorrentProvider.getID()}_minleech" id="${curTorrentProvider.getID()}_minleech" value="$curTorrentProvider.minleech" size="40" />
|
||||
</label>
|
||||
</div>
|
||||
#end if
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
# Sick Beard is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# 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
|
||||
# along with Sick Beard. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
@ -944,7 +944,8 @@ def initialize(consoleLogging=True):
|
|||
properFinderScheduler.silent = True
|
||||
|
||||
autoPostProcesserScheduler = scheduler.Scheduler(autoPostProcesser.PostProcesser(),
|
||||
cycleTime=datetime.timedelta(minutes=AUTOPOSTPROCESSER_FREQUENCY),
|
||||
cycleTime=datetime.timedelta(
|
||||
minutes=AUTOPOSTPROCESSER_FREQUENCY),
|
||||
threadName="POSTPROCESSER",
|
||||
runImmediately=True)
|
||||
if not PROCESS_AUTOMATICALLY:
|
||||
|
@ -1018,14 +1019,14 @@ def initialize(consoleLogging=True):
|
|||
curTorrentProvider.options = check_setting_str(CFG, curTorrentProvider.getID().upper(),
|
||||
curTorrentProvider.getID() + '_options', '')
|
||||
if hasattr(curTorrentProvider, 'ratio'):
|
||||
curTorrentProvider.ratio = float(check_setting_float(CFG, curTorrentProvider.getID().upper(),
|
||||
curTorrentProvider.getID() + '_ratio', 0))
|
||||
curTorrentProvider.ratio = check_setting_str(CFG, curTorrentProvider.getID().upper(),
|
||||
curTorrentProvider.getID() + '_ratio', '')
|
||||
if hasattr(curTorrentProvider, 'minseed'):
|
||||
curTorrentProvider.minseed = check_setting_int(CFG, curTorrentProvider.getID().upper(),
|
||||
curTorrentProvider.getID() + '_minseed', 0)
|
||||
curTorrentProvider.getID() + '_minseed', 0)
|
||||
if hasattr(curTorrentProvider, 'minleech'):
|
||||
curTorrentProvider.minleech = check_setting_int(CFG, curTorrentProvider.getID().upper(),
|
||||
curTorrentProvider.getID() + '_minleech', 0)
|
||||
curTorrentProvider.getID() + '_minleech', 0)
|
||||
if hasattr(curTorrentProvider, 'freeleech'):
|
||||
curTorrentProvider.freeleech = bool(check_setting_int(CFG, curTorrentProvider.getID().upper(),
|
||||
curTorrentProvider.getID() + '_freeleech', 0))
|
||||
|
@ -1054,16 +1055,16 @@ def initialize(consoleLogging=True):
|
|||
curNzbProvider.getID() + '_username', '')
|
||||
if hasattr(curNzbProvider, 'search_mode'):
|
||||
curNzbProvider.search_mode = check_setting_str(CFG, curNzbProvider.getID().upper(),
|
||||
curNzbProvider.getID() + '_search_mode',
|
||||
'eponly')
|
||||
curNzbProvider.getID() + '_search_mode',
|
||||
'eponly')
|
||||
if hasattr(curNzbProvider, 'search_fallback'):
|
||||
curNzbProvider.search_fallback = bool(check_setting_int(CFG, curNzbProvider.getID().upper(),
|
||||
curNzbProvider.getID() + '_search_fallback',
|
||||
0))
|
||||
curNzbProvider.getID() + '_search_fallback',
|
||||
0))
|
||||
if hasattr(curNzbProvider, 'backlog_only'):
|
||||
curNzbProvider.backlog_only = bool(check_setting_int(CFG, curNzbProvider.getID().upper(),
|
||||
curNzbProvider.getID() + '_backlog_only',
|
||||
0))
|
||||
curNzbProvider.getID() + '_backlog_only',
|
||||
0))
|
||||
|
||||
try:
|
||||
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(
|
||||
curTorrentProvider.confirmed)
|
||||
if hasattr(curTorrentProvider, 'ratio'):
|
||||
new_config[curTorrentProvider.getID().upper()][curTorrentProvider.getID() + '_ratio'] = float(
|
||||
curTorrentProvider.ratio)
|
||||
new_config[curTorrentProvider.getID().upper()][
|
||||
curTorrentProvider.getID() + '_ratio'] = curTorrentProvider.ratio
|
||||
if hasattr(curTorrentProvider, 'minseed'):
|
||||
new_config[curTorrentProvider.getID().upper()][curTorrentProvider.getID() + '_minseed'] = int(
|
||||
curTorrentProvider.minseed)
|
||||
|
|
|
@ -164,31 +164,24 @@ class DelugeAPI(GenericClient):
|
|||
|
||||
def _set_torrent_ratio(self, result):
|
||||
|
||||
ratio = ''
|
||||
ratio = None
|
||||
if 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",
|
||||
"params": [result.hash, True],
|
||||
"id": 5
|
||||
})
|
||||
self._request(method='post', data=post_data)
|
||||
|
||||
post_data = json.dumps({"method": "core.set_torrent_stop_at_ratio",
|
||||
"params": [result.hash, True],
|
||||
"id": 5
|
||||
})
|
||||
self._request(method='post', data=post_data)
|
||||
post_data = json.dumps({"method": "core.set_torrent_stop_ratio",
|
||||
"params": [result.hash, float(ratio)],
|
||||
"id": 6
|
||||
})
|
||||
self._request(method='post', data=post_data)
|
||||
|
||||
post_data = json.dumps({"method": "core.set_torrent_stop_ratio",
|
||||
"params": [result.hash, float(ratio)],
|
||||
"id": 6
|
||||
})
|
||||
self._request(method='post', data=post_data)
|
||||
|
||||
return not self.response.json()['error']
|
||||
return not self.response.json()['error']
|
||||
|
||||
return True
|
||||
|
||||
|
|
|
@ -80,7 +80,7 @@ class TransmissionAPI(GenericClient):
|
|||
|
||||
def _set_torrent_ratio(self, result):
|
||||
|
||||
ratio = ''
|
||||
ratio = None
|
||||
if result.ratio:
|
||||
ratio = result.ratio
|
||||
if ratio:
|
||||
|
@ -92,16 +92,14 @@ class TransmissionAPI(GenericClient):
|
|||
|
||||
torrent_id = self._get_torrent_hash(result)
|
||||
|
||||
if ratio == '':
|
||||
# Use global settings
|
||||
ratio = None
|
||||
mode = 0
|
||||
elif float(ratio) == 0:
|
||||
ratio = 0
|
||||
mode = 2
|
||||
elif float(ratio) > 0:
|
||||
ratio = float(ratio)
|
||||
mode = 1 # Stop seeding at seedRatioLimit
|
||||
mode = 0
|
||||
if ratio:
|
||||
if float(ratio) == 0:
|
||||
ratio = 0
|
||||
mode = 2
|
||||
elif float(ratio) > 0:
|
||||
ratio = float(ratio)
|
||||
mode = 1 # Stop seeding at seedRatioLimit
|
||||
|
||||
arguments = {'ids': [torrent_id],
|
||||
'seedRatioLimit': ratio,
|
||||
|
|
|
@ -67,33 +67,27 @@ class uTorrentAPI(GenericClient):
|
|||
|
||||
def _set_torrent_ratio(self, result):
|
||||
|
||||
ratio = ''
|
||||
ratio = None
|
||||
if 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
|
||||
|
||||
ratio = 10 * float(ratio)
|
||||
params = {'action': 'setprops',
|
||||
'hash': result.hash,
|
||||
's': 'seed_override',
|
||||
'v': '1'
|
||||
}
|
||||
if self._request(params=params):
|
||||
if ratio:
|
||||
params = {'action': 'setprops',
|
||||
'hash': result.hash,
|
||||
's': 'seed_ratio',
|
||||
'v': ratio
|
||||
's': 'seed_override',
|
||||
'v': '1'
|
||||
}
|
||||
return self._request(params=params)
|
||||
else:
|
||||
return False
|
||||
if self._request(params=params):
|
||||
params = {'action': 'setprops',
|
||||
'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):
|
||||
|
||||
|
|
|
@ -1593,9 +1593,9 @@ class ConfigProviders:
|
|||
|
||||
if hasattr(curTorrentProvider, 'ratio'):
|
||||
try:
|
||||
curTorrentProvider.ratio = float(str(kwargs[curTorrentProvider.getID() + '_ratio']).strip())
|
||||
curTorrentProvider.ratio = str(kwargs[curTorrentProvider.getID() + '_ratio']).strip()
|
||||
except:
|
||||
curTorrentProvider.ratio = 0
|
||||
curTorrentProvider.ratio = None
|
||||
|
||||
if hasattr(curTorrentProvider, 'digest'):
|
||||
try:
|
||||
|
|
Loading…
Reference in a new issue