mirror of
https://github.com/moparisthebest/SickRage
synced 2024-12-13 03:22:22 -05:00
Adds seed time and seed ratio to utorrent client
Adds support for setting the seed ratio and seed duration for the utorrent client.
This commit is contained in:
parent
160b4bc4cc
commit
fea4ef43b7
@ -395,6 +395,17 @@
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="field-pair" id="Torrent_Seed_Time">
|
||||
<label class="nocheck clearfix">
|
||||
<span class="component-title" id="torrent_seed_time_desc">Seed Time</span>
|
||||
<input type="number" step="0.1" name="torrent_seed_time" id="torrent_seed_time" value="$sickbeard.TORRENT_SEED_TIME" size="2" />
|
||||
</label>
|
||||
<label class="nocheck clearfix">
|
||||
<span class="component-title"> </span>
|
||||
<span class="component-desc">Duration (in hours) to seed for (blank for default)</span>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="field-pair" id="Torrent_Paused">
|
||||
<label class="nocheck clearfix">
|
||||
<span class="component-title" id="torrent_paused_desc">Start Torrent Paused</span>
|
||||
|
@ -44,11 +44,12 @@ $(document).ready(function(){
|
||||
} else if (selectedProvider == "utorrent") {
|
||||
$('#t_blackhole_settings').hide();
|
||||
$('#torrent_settings').show();
|
||||
$('#Torrent_username').show()
|
||||
$('#Torrent_username').show();
|
||||
$('#Torrent_Path').hide();
|
||||
$('#Torrent_Ratio').hide();
|
||||
$('#Torrent_Ratio').show();
|
||||
$('#Torrent_Seed_Time').show();
|
||||
$('#Torrent_High_Bandwidth').hide();
|
||||
$('#Torrent_Label').show()
|
||||
$('#Torrent_Label').show();
|
||||
$('#host_desc').text('uTorrent Host');
|
||||
$('#username_desc').text('uTorrent Username');
|
||||
$('#password_desc').text('uTorrent Password');
|
||||
@ -59,6 +60,7 @@ $(document).ready(function(){
|
||||
$('#Torrent_username').show();
|
||||
$('#Torrent_Path').show();
|
||||
$('#Torrent_Ratio').show();
|
||||
$('#Torrent_Seed_Time').hide();
|
||||
$('#Torrent_High_Bandwidth').show();
|
||||
$('#Torrent_Label').hide();
|
||||
$('#host_desc').html('Transmission Host');
|
||||
@ -72,6 +74,7 @@ $(document).ready(function(){
|
||||
$('#Torrent_username').hide();
|
||||
$('#Torrent_Path').show();
|
||||
$('#Torrent_Ratio').show();
|
||||
$('#Torrent_Seed_Time').hide();
|
||||
$('#Torrent_High_Bandwidth').hide();
|
||||
$('#host_desc').text('Deluge Host');
|
||||
$('#username_desc').text('Deluge Username');
|
||||
@ -86,6 +89,7 @@ $(document).ready(function(){
|
||||
$('#Torrent_Paused').hide();
|
||||
$('#Torrent_Path').hide();
|
||||
$('#Torrent_Ratio').hide();
|
||||
$('#Torrent_Seed_Time').hide();
|
||||
$('#Torrent_High_Bandwidth').hide();
|
||||
$('#host_desc').text('Synology Host');
|
||||
$('#username_desc').text('Synology Username');
|
||||
@ -100,6 +104,7 @@ $(document).ready(function(){
|
||||
$('#Torrent_Paused').hide();
|
||||
$('#Torrent_Path').show();
|
||||
$('#Torrent_Ratio').show();
|
||||
$('#Torrent_Seed_Time').hide();
|
||||
$('#Torrent_High_Bandwidth').hide();
|
||||
$('#host_desc').text('rTorrent Host');
|
||||
$('#username_desc').text('rTorrent Username');
|
||||
|
@ -279,6 +279,7 @@ TORRENT_PASSWORD = None
|
||||
TORRENT_HOST = ''
|
||||
TORRENT_PATH = ''
|
||||
TORRENT_RATIO = ''
|
||||
TORRENT_SEED_TIME = ''
|
||||
TORRENT_PAUSED = False
|
||||
TORRENT_HIGH_BANDWIDTH = False
|
||||
TORRENT_LABEL = ''
|
||||
@ -460,7 +461,7 @@ def initialize(consoleLogging=True):
|
||||
USE_NZBS, USE_TORRENTS, NZB_METHOD, NZB_DIR, DOWNLOAD_PROPERS, ALLOW_HIGH_PRIORITY, TORRENT_METHOD, \
|
||||
SAB_USERNAME, SAB_PASSWORD, SAB_APIKEY, SAB_CATEGORY, SAB_HOST, \
|
||||
NZBGET_USERNAME, NZBGET_PASSWORD, NZBGET_CATEGORY, NZBGET_HOST, currentSearchScheduler, backlogSearchScheduler, \
|
||||
TORRENT_USERNAME, TORRENT_PASSWORD, TORRENT_HOST, TORRENT_PATH, TORRENT_RATIO, TORRENT_PAUSED, TORRENT_HIGH_BANDWIDTH, TORRENT_LABEL, \
|
||||
TORRENT_USERNAME, TORRENT_PASSWORD, TORRENT_HOST, TORRENT_PATH, TORRENT_RATIO, TORRENT_SEED_TIME, TORRENT_PAUSED, TORRENT_HIGH_BANDWIDTH, TORRENT_LABEL, \
|
||||
USE_XBMC, XBMC_NOTIFY_ONSNATCH, XBMC_NOTIFY_ONDOWNLOAD, XBMC_NOTIFY_ONSUBTITLEDOWNLOAD, XBMC_UPDATE_FULL, XBMC_UPDATE_ONLYFIRST, \
|
||||
XBMC_UPDATE_LIBRARY, XBMC_HOST, XBMC_USERNAME, XBMC_PASSWORD, \
|
||||
USE_TRAKT, TRAKT_USERNAME, TRAKT_PASSWORD, TRAKT_API, TRAKT_REMOVE_WATCHLIST, TRAKT_USE_WATCHLIST, TRAKT_METHOD_ADD, TRAKT_START_PAUSED, traktWatchListCheckerSchedular, \
|
||||
@ -747,6 +748,7 @@ def initialize(consoleLogging=True):
|
||||
TORRENT_HOST = check_setting_str(CFG, 'TORRENT', 'torrent_host', '')
|
||||
TORRENT_PATH = check_setting_str(CFG, 'TORRENT', 'torrent_path', '')
|
||||
TORRENT_RATIO = check_setting_str(CFG, 'TORRENT', 'torrent_ratio', '')
|
||||
TORRENT_SEED_TIME = check_setting_str(CFG, 'TORRENT', 'torrent_seed_time', '')
|
||||
TORRENT_PAUSED = bool(check_setting_int(CFG, 'TORRENT', 'torrent_paused', 0))
|
||||
TORRENT_HIGH_BANDWIDTH = bool(check_setting_int(CFG, 'TORRENT', 'torrent_high_bandwidth', 0))
|
||||
TORRENT_LABEL = check_setting_str(CFG, 'TORRENT', 'torrent_label', '')
|
||||
@ -1475,6 +1477,7 @@ def save_config():
|
||||
new_config['TORRENT']['torrent_host'] = TORRENT_HOST
|
||||
new_config['TORRENT']['torrent_path'] = TORRENT_PATH
|
||||
new_config['TORRENT']['torrent_ratio'] = TORRENT_RATIO
|
||||
new_config['TORRENT']['torrent_seed_time'] = TORRENT_SEED_TIME
|
||||
new_config['TORRENT']['torrent_paused'] = int(TORRENT_PAUSED)
|
||||
new_config['TORRENT']['torrent_high_bandwidth'] = int(TORRENT_HIGH_BANDWIDTH)
|
||||
new_config['TORRENT']['torrent_label'] = TORRENT_LABEL
|
||||
|
@ -112,6 +112,13 @@ class GenericClient(object):
|
||||
"""
|
||||
return True
|
||||
|
||||
def _set_torrent_seed_time(self, result):
|
||||
"""
|
||||
This should be overridden should return the True/False from the client
|
||||
when a torrent is set with a seed time
|
||||
"""
|
||||
return True
|
||||
|
||||
def _set_torrent_priority(self, result):
|
||||
"""
|
||||
This should be overriden should return the True/False from the client
|
||||
@ -176,6 +183,9 @@ class GenericClient(object):
|
||||
if not self._set_torrent_ratio(result):
|
||||
logger.log(self.name + u': Unable to set the ratio for Torrent', logger.ERROR)
|
||||
|
||||
if not self._set_torrent_seed_time(result):
|
||||
logger.log(self.name + u': Unable to set the seed time for Torrent', logger.ERROR)
|
||||
|
||||
if not self._set_torrent_path(result):
|
||||
logger.log(self.name + u': Unable to set the path for Torrent', logger.ERROR)
|
||||
|
||||
|
@ -63,12 +63,56 @@ class uTorrentAPI(GenericClient):
|
||||
'v': sickbeard.TORRENT_LABEL
|
||||
}
|
||||
return self._request(params=params)
|
||||
|
||||
def _set_torrent_ratio(self, result):
|
||||
|
||||
if sickbeard.TORRENT_RATIO != '':
|
||||
ratio = 10 * float(sickbeard.TORRENT_RATIO)
|
||||
params = {'action': 'setprops',
|
||||
'hash': result.hash,
|
||||
's': 'seed_override',
|
||||
'v': '1'
|
||||
}
|
||||
if self._request(params=params):
|
||||
params = {'action': 'setprops',
|
||||
'hash': result.hash,
|
||||
's': 'seed_ratio',
|
||||
'v': ratio
|
||||
}
|
||||
return self._request(params=params)
|
||||
else:
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
|
||||
def _set_torrent_seed_time(self, result):
|
||||
|
||||
if sickbeard.TORRENT_SEED_TIME != '':
|
||||
time = 3600 * float(sickbeard.TORRENT_SEED_TIME)
|
||||
params = {'action': 'setprops',
|
||||
'hash': result.hash,
|
||||
's': 'seed_override',
|
||||
'v': '1'
|
||||
}
|
||||
if self._request(params=params):
|
||||
params = {'action': 'setprops',
|
||||
'hash': result.hash,
|
||||
's': 'seed_time',
|
||||
'v': time
|
||||
}
|
||||
return self._request(params=params)
|
||||
else:
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
|
||||
def _set_torrent_priority(self, result):
|
||||
|
||||
if result.priority == 1:
|
||||
params = {'action': 'queuetop', 'hash': result.hash}
|
||||
return self._request(params=params)
|
||||
return self._request(params=params)
|
||||
else:
|
||||
return True
|
||||
|
||||
def _set_torrent_pause(self, result):
|
||||
|
||||
|
@ -1056,7 +1056,7 @@ class ConfigSearch:
|
||||
download_propers=None, allow_high_priority=None,
|
||||
torrent_dir=None, torrent_username=None, torrent_password=None, torrent_host=None,
|
||||
torrent_label=None, torrent_path=None,
|
||||
torrent_ratio=None, torrent_paused=None, torrent_high_bandwidth=None, ignore_words=None):
|
||||
torrent_ratio=None, torrent_seed_time=None, torrent_paused=None, torrent_high_bandwidth=None, ignore_words=None):
|
||||
|
||||
results = []
|
||||
|
||||
@ -1101,6 +1101,7 @@ class ConfigSearch:
|
||||
sickbeard.TORRENT_LABEL = torrent_label
|
||||
sickbeard.TORRENT_PATH = torrent_path
|
||||
sickbeard.TORRENT_RATIO = torrent_ratio
|
||||
sickbeard.TORRENT_SEED_TIME = torrent_seed_time
|
||||
sickbeard.TORRENT_PAUSED = config.checkbox_to_value(torrent_paused)
|
||||
sickbeard.TORRENT_HIGH_BANDWIDTH = config.checkbox_to_value(torrent_high_bandwidth)
|
||||
sickbeard.TORRENT_HOST = config.clean_url(torrent_host)
|
||||
|
Loading…
Reference in New Issue
Block a user