mirror of
https://github.com/SickGear/SickGear.git
synced 2024-12-11 05:33:37 +00:00
Merge pull request #504 from JackDandy/feature/AddSeedTimePerProvider
Add seed time per provider for torrent clients that support seed time…
This commit is contained in:
commit
6267156831
9 changed files with 46 additions and 27 deletions
|
@ -28,6 +28,8 @@
|
||||||
* Fix saving torrent provider option "Seed until ratio" after recent refactor
|
* Fix saving torrent provider option "Seed until ratio" after recent refactor
|
||||||
* Change white text in light theme on Manage / Episode Status Management page to black for better readability
|
* Change white text in light theme on Manage / Episode Status Management page to black for better readability
|
||||||
* Change displayShow page episode colours when a minimum quality is met with "End upgrade on first match"
|
* Change displayShow page episode colours when a minimum quality is met with "End upgrade on first match"
|
||||||
|
* Add seed time per provider for torrent clients that support seed time per torrent, i.e. currently only uTorrent
|
||||||
|
* Remove seed time display for Transmission in config/Torrent Search page because the torrent client doesn't support it
|
||||||
* Add SceneTime torrent provider
|
* Add SceneTime torrent provider
|
||||||
* Change TtN provider to parse new layout
|
* Change TtN provider to parse new layout
|
||||||
* Improve recognition of SD quality
|
* Improve recognition of SD quality
|
||||||
|
|
|
@ -408,14 +408,28 @@
|
||||||
</div>
|
</div>
|
||||||
#end if
|
#end if
|
||||||
#if $hasattr($curTorrentProvider, '_seed_ratio') and 'blackhole' != $sickbeard.TORRENT_METHOD:
|
#if $hasattr($curTorrentProvider, '_seed_ratio') and 'blackhole' != $sickbeard.TORRENT_METHOD:
|
||||||
#set $torrent_method_text = {'blackhole': 'Black hole', 'utorrent': 'uTorrent', 'transmission': 'Transmission', 'deluge': 'Deluge', 'download_station': 'Synology DS', 'rtorrent': 'rTorrent'}
|
#set $torrent_method_text = {'utorrent': 'uTorrent', 'transmission': 'Transmission', 'deluge': 'Deluge', 'download_station': 'Synology DS', 'rtorrent': 'rTorrent'}
|
||||||
<div class="field-pair">
|
<div class="field-pair">
|
||||||
<label for="${curTorrentProvider.get_id()}_ratio">
|
<label for="${curTorrentProvider.get_id()}_ratio">
|
||||||
<span class="component-title" id="${curTorrentProvider.get_id()}_ratio_desc">Seed until ratio (the goal)</span>
|
<span class="component-title" id="${curTorrentProvider.get_id()}_ratio_desc">Seed until ratio (the goal)</span>
|
||||||
<span class="component-desc">
|
<span class="component-desc">
|
||||||
<input type="number" step="0.1" name="${curTorrentProvider.get_id()}_ratio" id="${curTorrentProvider.get_id()}_ratio" value="$curTorrentProvider._seed_ratio" class="form-control input-sm input75" />
|
<input type="number" name="${curTorrentProvider.get_id()}_ratio" id="${curTorrentProvider.get_id()}_ratio" value="$curTorrentProvider._seed_ratio" class="form-control input-sm input75" />
|
||||||
<p>this ratio is requested of each download sent to $torrent_method_text[$sickbeard.TORRENT_METHOD]</p>
|
<p>this ratio is requested of each item sent to $torrent_method_text[$sickbeard.TORRENT_METHOD]</p>
|
||||||
<div class="clear-left"><p>(set -1 to seed forever, or leave blank for the $torrent_method_text[$sickbeard.TORRENT_METHOD] default)</p></div>
|
<div class="clear-left"><p>(set -1 to seed forever, or leave blank for the $torrent_method_text[$sickbeard.TORRENT_METHOD] setting)</p></div>
|
||||||
|
</span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
#end if
|
||||||
|
#if $hasattr($curTorrentProvider, 'seed_time') and 'utorrent' == $sickbeard.TORRENT_METHOD:
|
||||||
|
#set $torrent_method_text = {'utorrent': 'uTorrent'}
|
||||||
|
#set $use_default = 'to use the %s min <a href="%s/config/search/#core-component-group3">torrent search setting minumum default</a>' % ($sickbeard.TORRENT_SEED_TIME, $sbRoot) if $sickbeard.TORRENT_SEED_TIME else 'for the %s setting' % $torrent_method_text[$sickbeard.TORRENT_METHOD]
|
||||||
|
<div class="field-pair">
|
||||||
|
<label for="${curTorrentProvider.get_id()}_seed_time">
|
||||||
|
<span class="component-title" id="${curTorrentProvider.get_id()}_seed_time_desc">Seed time (provider default)</span>
|
||||||
|
<span class="component-desc">
|
||||||
|
<input type="number" name="${curTorrentProvider.get_id()}_seed_time" id="${curTorrentProvider.get_id()}_seed_time" value="$curTorrentProvider.seed_time" class="form-control input-sm input75" />
|
||||||
|
<p>set 1 or more minimum minutes for each item sent to $torrent_method_text[$sickbeard.TORRENT_METHOD]</p>
|
||||||
|
<div class="clear-left"><p>(leave blank $use_default)</p></div>
|
||||||
</span>
|
</span>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -473,9 +473,9 @@
|
||||||
|
|
||||||
<div class="field-pair" id="torrent_seed_time_option">
|
<div class="field-pair" id="torrent_seed_time_option">
|
||||||
<label>
|
<label>
|
||||||
<span class="component-title">Minimum seeding time is</span>
|
<span class="component-title">Seed time (minimum default)</span>
|
||||||
<span class="component-desc"><input type="number" step="0.1" name="torrent_seed_time" id="torrent_seed_time" value="$sickbeard.TORRENT_SEED_TIME" class="form-control input-sm input100">
|
<span class="component-desc"><input type="number" step="0.1" name="torrent_seed_time" id="torrent_seed_time" value="$sickbeard.TORRENT_SEED_TIME" class="form-control input-sm input100">
|
||||||
<p>hours. (default:'0' passes blank to client and '-1' passes nothing)</p></span>
|
<p>1 or more minutes. (0 or blank to use the client setting)</p></span>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -80,7 +80,6 @@ $(document).ready(function(){
|
||||||
$(torrent_seed_time_option).show();
|
$(torrent_seed_time_option).show();
|
||||||
} else if ('transmission' == selectedProvider){
|
} else if ('transmission' == selectedProvider){
|
||||||
client = 'Transmission';
|
client = 'Transmission';
|
||||||
$(torrent_seed_time_option).show();
|
|
||||||
$(torrent_high_bandwidth_option).show();
|
$(torrent_high_bandwidth_option).show();
|
||||||
$(torrent_label_option).hide();
|
$(torrent_label_option).hide();
|
||||||
//$('#directory_title').text(client + directory);
|
//$('#directory_title').text(client + directory);
|
||||||
|
|
|
@ -1003,6 +1003,8 @@ def initialize(consoleLogging=True):
|
||||||
torrent_prov.options = check_setting_str(CFG, prov_id_uc, prov_id + '_options', '')
|
torrent_prov.options = check_setting_str(CFG, prov_id_uc, prov_id + '_options', '')
|
||||||
if hasattr(torrent_prov, '_seed_ratio'):
|
if hasattr(torrent_prov, '_seed_ratio'):
|
||||||
torrent_prov._seed_ratio = check_setting_str(CFG, prov_id_uc, prov_id + '_seed_ratio', '')
|
torrent_prov._seed_ratio = check_setting_str(CFG, prov_id_uc, prov_id + '_seed_ratio', '')
|
||||||
|
if hasattr(torrent_prov, 'seed_time'):
|
||||||
|
torrent_prov.seed_time = check_setting_int(CFG, prov_id_uc, prov_id + '_seed_time', '')
|
||||||
if hasattr(torrent_prov, 'minseed'):
|
if hasattr(torrent_prov, 'minseed'):
|
||||||
torrent_prov.minseed = check_setting_int(CFG, prov_id_uc, prov_id + '_minseed', 0)
|
torrent_prov.minseed = check_setting_int(CFG, prov_id_uc, prov_id + '_minseed', 0)
|
||||||
if hasattr(torrent_prov, 'minleech'):
|
if hasattr(torrent_prov, 'minleech'):
|
||||||
|
@ -1486,6 +1488,8 @@ def save_config():
|
||||||
new_config[prov_id_uc][prov_id + '_confirmed'] = int(torrent_prov.confirmed)
|
new_config[prov_id_uc][prov_id + '_confirmed'] = int(torrent_prov.confirmed)
|
||||||
if hasattr(torrent_prov, '_seed_ratio'):
|
if hasattr(torrent_prov, '_seed_ratio'):
|
||||||
new_config[prov_id_uc][prov_id + '_seed_ratio'] = torrent_prov.seed_ratio()
|
new_config[prov_id_uc][prov_id + '_seed_ratio'] = torrent_prov.seed_ratio()
|
||||||
|
if hasattr(torrent_prov, 'seed_time'):
|
||||||
|
new_config[prov_id_uc][prov_id + '_seed_time'] = torrent_prov.seed_time
|
||||||
if hasattr(torrent_prov, 'minseed'):
|
if hasattr(torrent_prov, 'minseed'):
|
||||||
new_config[prov_id_uc][prov_id + '_minseed'] = int(torrent_prov.minseed)
|
new_config[prov_id_uc][prov_id + '_minseed'] = int(torrent_prov.minseed)
|
||||||
if hasattr(torrent_prov, 'minleech'):
|
if hasattr(torrent_prov, 'minleech'):
|
||||||
|
|
|
@ -107,16 +107,14 @@ class TransmissionAPI(GenericClient):
|
||||||
|
|
||||||
def _set_torrent_seed_time(self, result):
|
def _set_torrent_seed_time(self, result):
|
||||||
|
|
||||||
if sickbeard.TORRENT_SEED_TIME and sickbeard.TORRENT_SEED_TIME != -1:
|
if result.provider.seed_time or (sickbeard.TORRENT_SEED_TIME and sickbeard.TORRENT_SEED_TIME != -1):
|
||||||
time = int(60 * float(sickbeard.TORRENT_SEED_TIME))
|
seed_time = result.provider.seed_time or sickbeard.TORRENT_SEED_TIME
|
||||||
arguments = {'ids': [result.hash],
|
arguments = {'ids': [result.hash],
|
||||||
'seedIdleLimit': time,
|
'seedIdleLimit': int(seed_time) * 60,
|
||||||
'seedIdleMode': 1
|
'seedIdleMode': 1}
|
||||||
}
|
|
||||||
|
|
||||||
post_data = json.dumps({'arguments': arguments,
|
post_data = json.dumps({'arguments': arguments,
|
||||||
'method': 'torrent-set',
|
'method': 'torrent-set'})
|
||||||
})
|
|
||||||
response = self._request(method='post', data=post_data)
|
response = self._request(method='post', data=post_data)
|
||||||
|
|
||||||
return response.json()['result'] == 'success'
|
return response.json()['result'] == 'success'
|
||||||
|
|
|
@ -95,19 +95,17 @@ class uTorrentAPI(GenericClient):
|
||||||
|
|
||||||
def _set_torrent_seed_time(self, result):
|
def _set_torrent_seed_time(self, result):
|
||||||
|
|
||||||
if sickbeard.TORRENT_SEED_TIME:
|
seed_time = result.provider.seed_time or sickbeard.TORRENT_SEED_TIME
|
||||||
time = 3600 * float(sickbeard.TORRENT_SEED_TIME)
|
if seed_time:
|
||||||
params = {'action': 'setprops',
|
params = {'action': 'setprops',
|
||||||
'hash': result.hash,
|
'hash': result.hash,
|
||||||
's': 'seed_override',
|
's': 'seed_override',
|
||||||
'v': '1'
|
'v': '1'}
|
||||||
}
|
|
||||||
if self._request(params=params):
|
if self._request(params=params):
|
||||||
params = {'action': 'setprops',
|
params = {'action': 'setprops',
|
||||||
'hash': result.hash,
|
'hash': result.hash,
|
||||||
's': 'seed_time',
|
's': 'seed_time',
|
||||||
'v': time
|
'v': int(seed_time) * 60}
|
||||||
}
|
|
||||||
return self._request(params=params)
|
return self._request(params=params)
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
|
|
@ -614,6 +614,7 @@ class TorrentProvider(GenericProvider):
|
||||||
self.providerType = GenericProvider.TORRENT
|
self.providerType = GenericProvider.TORRENT
|
||||||
|
|
||||||
self._seed_ratio = None
|
self._seed_ratio = None
|
||||||
|
self.seed_time = None
|
||||||
|
|
||||||
def image_name(self):
|
def image_name(self):
|
||||||
|
|
||||||
|
|
|
@ -3655,7 +3655,7 @@ class ConfigSearch(Config):
|
||||||
sickbeard.TORRENT_LABEL = torrent_label
|
sickbeard.TORRENT_LABEL = torrent_label
|
||||||
sickbeard.TORRENT_VERIFY_CERT = config.checkbox_to_value(torrent_verify_cert)
|
sickbeard.TORRENT_VERIFY_CERT = config.checkbox_to_value(torrent_verify_cert)
|
||||||
sickbeard.TORRENT_PATH = torrent_path
|
sickbeard.TORRENT_PATH = torrent_path
|
||||||
sickbeard.TORRENT_SEED_TIME = torrent_seed_time
|
sickbeard.TORRENT_SEED_TIME = config.to_int(torrent_seed_time, 0)
|
||||||
sickbeard.TORRENT_PAUSED = config.checkbox_to_value(torrent_paused)
|
sickbeard.TORRENT_PAUSED = config.checkbox_to_value(torrent_paused)
|
||||||
sickbeard.TORRENT_HIGH_BANDWIDTH = config.checkbox_to_value(torrent_high_bandwidth)
|
sickbeard.TORRENT_HIGH_BANDWIDTH = config.checkbox_to_value(torrent_high_bandwidth)
|
||||||
sickbeard.TORRENT_HOST = config.clean_url(torrent_host)
|
sickbeard.TORRENT_HOST = config.clean_url(torrent_host)
|
||||||
|
@ -4143,6 +4143,15 @@ class ConfigProviders(Config):
|
||||||
for curTorrentProvider in [curProvider for curProvider in sickbeard.providers.sortedProviderList() if
|
for curTorrentProvider in [curProvider for curProvider in sickbeard.providers.sortedProviderList() if
|
||||||
curProvider.providerType == sickbeard.GenericProvider.TORRENT]:
|
curProvider.providerType == sickbeard.GenericProvider.TORRENT]:
|
||||||
|
|
||||||
|
if hasattr(curTorrentProvider, '_seed_ratio'):
|
||||||
|
try:
|
||||||
|
curTorrentProvider._seed_ratio = str(kwargs[curTorrentProvider.get_id() + '_ratio']).strip()
|
||||||
|
except:
|
||||||
|
curTorrentProvider._seed_ratio = None
|
||||||
|
|
||||||
|
if hasattr(curTorrentProvider, 'seed_time') and curTorrentProvider.get_id() + '_seed_time' in kwargs:
|
||||||
|
curTorrentProvider.seed_time = config.to_int(str(kwargs[curTorrentProvider.get_id() + '_seed_time']).strip(), 0)
|
||||||
|
|
||||||
if hasattr(curTorrentProvider, 'minseed'):
|
if hasattr(curTorrentProvider, 'minseed'):
|
||||||
try:
|
try:
|
||||||
curTorrentProvider.minseed = int(str(kwargs[curTorrentProvider.get_id() + '_minseed']).strip())
|
curTorrentProvider.minseed = int(str(kwargs[curTorrentProvider.get_id() + '_minseed']).strip())
|
||||||
|
@ -4155,12 +4164,6 @@ class ConfigProviders(Config):
|
||||||
except:
|
except:
|
||||||
curTorrentProvider.minleech = 0
|
curTorrentProvider.minleech = 0
|
||||||
|
|
||||||
if hasattr(curTorrentProvider, '_seed_ratio'):
|
|
||||||
try:
|
|
||||||
curTorrentProvider._seed_ratio = str(kwargs[curTorrentProvider.get_id() + '_ratio']).strip()
|
|
||||||
except:
|
|
||||||
curTorrentProvider._seed_ratio = None
|
|
||||||
|
|
||||||
if hasattr(curTorrentProvider, 'digest'):
|
if hasattr(curTorrentProvider, 'digest'):
|
||||||
try:
|
try:
|
||||||
curTorrentProvider.digest = str(kwargs[curTorrentProvider.get_id() + '_digest']).strip()
|
curTorrentProvider.digest = str(kwargs[curTorrentProvider.get_id() + '_digest']).strip()
|
||||||
|
|
Loading…
Reference in a new issue