");
var removeTorznabButton = $("
");
removeTorznabButton.click(function() {
$(this).parent().remove();
diff --git a/headphones/config.py b/headphones/config.py
index ce283481..19156bad 100644
--- a/headphones/config.py
+++ b/headphones/config.py
@@ -284,6 +284,7 @@ _CONFIG_DEFINITIONS = {
'TORZNAB_APIKEY': (str, 'Torznab', ''),
'TORZNAB_ENABLED': (int, 'Torznab', 1),
'TORZNAB_HOST': (str, 'Torznab', ''),
+ 'TORZNAB_RATIO': (str, 'Torznab', ''),
'TRANSMISSION_HOST': (str, 'Transmission', ''),
'TRANSMISSION_PASSWORD': (str, 'Transmission', ''),
'TRANSMISSION_USERNAME': (str, 'Transmission', ''),
@@ -412,8 +413,8 @@ class Config(object):
def get_extra_torznabs(self):
""" Return the extra torznab tuples """
extra_torznabs = list(
- itertools.izip(*[itertools.islice(self.EXTRA_TORZNABS, i, None, 3)
- for i in range(3)])
+ itertools.izip(*[itertools.islice(self.EXTRA_TORZNABS, i, None, 4)
+ for i in range(4)])
)
return extra_torznabs
@@ -484,4 +485,19 @@ class Config(object):
if self.CONFIG_VERSION == '5':
if self.OPEN_MAGNET_LINKS:
self.MAGNET_LINKS = 2
- self.CONFIG_VERSION = '5'
+
+ # Add Seed Ratio to Torznabs
+ if self.EXTRA_TORZNABS:
+ extra_torznabs = list(
+ itertools.izip(*[itertools.islice(self.EXTRA_TORZNABS, i, None, 3)
+ for i in range(3)])
+ )
+ new_torznabs = []
+ for torznab in extra_torznabs:
+ new_torznabs.extend([torznab[0], torznab[1], u'', torznab[2]])
+ if new_torznabs:
+ self.EXTRA_TORZNABS = new_torznabs
+
+ self.CONFIG_VERSION = '6'
+
+
diff --git a/headphones/searcher.py b/headphones/searcher.py
index 9f7d1271..9cbbcc22 100644
--- a/headphones/searcher.py
+++ b/headphones/searcher.py
@@ -154,7 +154,7 @@ def calculate_torrent_hash(link, data=None):
def get_seed_ratio(provider):
"""
- Return the seed ratio for the specified provider, if applicable. Defaults to
+ Return the seed ratio for the specified provider if applicable. Defaults to
None in case of an error.
"""
@@ -172,6 +172,15 @@ def get_seed_ratio(provider):
seed_ratio = headphones.CONFIG.WAFFLES_RATIO
elif provider == 'Mininova':
seed_ratio = headphones.CONFIG.MININOVA_RATIO
+ elif provider.startswith("Jackett_"):
+ provider = provider.split("Jackett_")[1]
+ if provider in headphones.CONFIG.TORZNAB_HOST:
+ seed_ratio = headphones.CONFIG.TORZNAB_RATIO
+ else:
+ for torznab in headphones.CONFIG.get_extra_torznabs():
+ if provider in torznab[0]:
+ seed_ratio = torznab[2]
+ break
else:
seed_ratio = None
@@ -1266,10 +1275,10 @@ def searchTorrent(album, new=False, losslessOnly=False, albumlength=None,
if headphones.CONFIG.TORZNAB_HOST and headphones.CONFIG.TORZNAB_ENABLED:
torznab_hosts.append((headphones.CONFIG.TORZNAB_HOST, headphones.CONFIG.TORZNAB_APIKEY,
- headphones.CONFIG.TORZNAB_ENABLED))
+ headphones.CONFIG.TORZNAB_RATIO, headphones.CONFIG.TORZNAB_ENABLED))
for torznab_host in headphones.CONFIG.get_extra_torznabs():
- if torznab_host[2] == '1' or torznab_host[2] == 1:
+ if torznab_host[3] == '1' or torznab_host[3] == 1:
torznab_hosts.append(torznab_host)
if headphones.CONFIG.PREFERRED_QUALITY == 3 or losslessOnly:
diff --git a/headphones/webserve.py b/headphones/webserve.py
index 483019de..3f36333c 100644
--- a/headphones/webserve.py
+++ b/headphones/webserve.py
@@ -1213,6 +1213,7 @@ class WebInterface(object):
"use_torznab": checked(headphones.CONFIG.TORZNAB),
"torznab_host": headphones.CONFIG.TORZNAB_HOST,
"torznab_apikey": headphones.CONFIG.TORZNAB_APIKEY,
+ "torznab_ratio": headphones.CONFIG.TORZNAB_RATIO,
"torznab_enabled": checked(headphones.CONFIG.TORZNAB_ENABLED),
"extra_torznabs": headphones.CONFIG.get_extra_torznabs(),
"use_nzbsorg": checked(headphones.CONFIG.NZBSORG),
@@ -1537,13 +1538,15 @@ class WebInterface(object):
if len(torznab_number):
torznab_api_key = 'torznab_api' + torznab_number
torznab_enabled_key = 'torznab_enabled' + torznab_number
+ torznab_ratio_key = 'torznab_ratio' + torznab_number
torznab_host = kwargs.get(torznab_host_key, '')
torznab_api = kwargs.get(torznab_api_key, '')
torznab_enabled = int(kwargs.get(torznab_enabled_key, 0))
- for key in [torznab_host_key, torznab_api_key, torznab_enabled_key]:
+ torznab_ratio = kwargs.get(torznab_ratio_key, '')
+ for key in [torznab_host_key, torznab_api_key, torznab_enabled_key, torznab_ratio_key]:
if key in kwargs:
del kwargs[key]
- extra_torznabs.append((torznab_host, torznab_api, torznab_enabled))
+ extra_torznabs.append((torznab_host, torznab_api, torznab_ratio, torznab_enabled))
# Convert the extras to list then string. Coming in as 0 or 1 (append new extras to the end)
temp_extras_list = []