diff --git a/CHANGES.md b/CHANGES.md index 3c0a562f..62118224 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -28,6 +28,8 @@ * 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 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 * Change TtN provider to parse new layout * Improve recognition of SD quality diff --git a/gui/slick/interfaces/default/config_providers.tmpl b/gui/slick/interfaces/default/config_providers.tmpl index b03631d6..6391f0ab 100644 --- a/gui/slick/interfaces/default/config_providers.tmpl +++ b/gui/slick/interfaces/default/config_providers.tmpl @@ -408,14 +408,28 @@ #end if #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'}
+
+ #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 torrent search setting minumum default' % ($sickbeard.TORRENT_SEED_TIME, $sbRoot) if $sickbeard.TORRENT_SEED_TIME else 'for the %s setting' % $torrent_method_text[$sickbeard.TORRENT_METHOD] +
+
diff --git a/gui/slick/interfaces/default/config_search.tmpl b/gui/slick/interfaces/default/config_search.tmpl index 98e8f70e..45e90acd 100755 --- a/gui/slick/interfaces/default/config_search.tmpl +++ b/gui/slick/interfaces/default/config_search.tmpl @@ -473,9 +473,9 @@
diff --git a/gui/slick/js/configSearch.js b/gui/slick/js/configSearch.js index 94c19931..6792df94 100644 --- a/gui/slick/js/configSearch.js +++ b/gui/slick/js/configSearch.js @@ -80,7 +80,6 @@ $(document).ready(function(){ $(torrent_seed_time_option).show(); } else if ('transmission' == selectedProvider){ client = 'Transmission'; - $(torrent_seed_time_option).show(); $(torrent_high_bandwidth_option).show(); $(torrent_label_option).hide(); //$('#directory_title').text(client + directory); diff --git a/sickbeard/__init__.py b/sickbeard/__init__.py index 9f383281..486c0fc7 100755 --- a/sickbeard/__init__.py +++ b/sickbeard/__init__.py @@ -1003,6 +1003,8 @@ def initialize(consoleLogging=True): torrent_prov.options = check_setting_str(CFG, prov_id_uc, prov_id + '_options', '') if hasattr(torrent_prov, '_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'): torrent_prov.minseed = check_setting_int(CFG, prov_id_uc, prov_id + '_minseed', 0) if hasattr(torrent_prov, 'minleech'): @@ -1486,6 +1488,8 @@ def save_config(): new_config[prov_id_uc][prov_id + '_confirmed'] = int(torrent_prov.confirmed) if hasattr(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'): new_config[prov_id_uc][prov_id + '_minseed'] = int(torrent_prov.minseed) if hasattr(torrent_prov, 'minleech'): diff --git a/sickbeard/clients/transmission.py b/sickbeard/clients/transmission.py index da551e54..defe3149 100755 --- a/sickbeard/clients/transmission.py +++ b/sickbeard/clients/transmission.py @@ -107,16 +107,14 @@ class TransmissionAPI(GenericClient): def _set_torrent_seed_time(self, result): - if sickbeard.TORRENT_SEED_TIME and sickbeard.TORRENT_SEED_TIME != -1: - time = int(60 * float(sickbeard.TORRENT_SEED_TIME)) + if result.provider.seed_time or (sickbeard.TORRENT_SEED_TIME and sickbeard.TORRENT_SEED_TIME != -1): + seed_time = result.provider.seed_time or sickbeard.TORRENT_SEED_TIME arguments = {'ids': [result.hash], - 'seedIdleLimit': time, - 'seedIdleMode': 1 - } + 'seedIdleLimit': int(seed_time) * 60, + 'seedIdleMode': 1} post_data = json.dumps({'arguments': arguments, - 'method': 'torrent-set', - }) + 'method': 'torrent-set'}) response = self._request(method='post', data=post_data) return response.json()['result'] == 'success' diff --git a/sickbeard/clients/utorrent.py b/sickbeard/clients/utorrent.py index 02fd82bd..72904402 100644 --- a/sickbeard/clients/utorrent.py +++ b/sickbeard/clients/utorrent.py @@ -95,19 +95,17 @@ class uTorrentAPI(GenericClient): def _set_torrent_seed_time(self, result): - if sickbeard.TORRENT_SEED_TIME: - time = 3600 * float(sickbeard.TORRENT_SEED_TIME) + seed_time = result.provider.seed_time or sickbeard.TORRENT_SEED_TIME + if seed_time: params = {'action': 'setprops', 'hash': result.hash, 's': 'seed_override', - 'v': '1' - } + 'v': '1'} if self._request(params=params): params = {'action': 'setprops', 'hash': result.hash, 's': 'seed_time', - 'v': time - } + 'v': int(seed_time) * 60} return self._request(params=params) else: return False diff --git a/sickbeard/providers/generic.py b/sickbeard/providers/generic.py index d2624498..ee00b065 100644 --- a/sickbeard/providers/generic.py +++ b/sickbeard/providers/generic.py @@ -614,6 +614,7 @@ class TorrentProvider(GenericProvider): self.providerType = GenericProvider.TORRENT self._seed_ratio = None + self.seed_time = None def image_name(self): diff --git a/sickbeard/webserve.py b/sickbeard/webserve.py index be552373..cea09773 100644 --- a/sickbeard/webserve.py +++ b/sickbeard/webserve.py @@ -3655,7 +3655,7 @@ class ConfigSearch(Config): sickbeard.TORRENT_LABEL = torrent_label sickbeard.TORRENT_VERIFY_CERT = config.checkbox_to_value(torrent_verify_cert) 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_HIGH_BANDWIDTH = config.checkbox_to_value(torrent_high_bandwidth) 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 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'): try: curTorrentProvider.minseed = int(str(kwargs[curTorrentProvider.get_id() + '_minseed']).strip()) @@ -4155,12 +4164,6 @@ class ConfigProviders(Config): except: 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'): try: curTorrentProvider.digest = str(kwargs[curTorrentProvider.get_id() + '_digest']).strip()