@@ -2031,16 +2032,16 @@
});
initActions();
initConfigCheckbox("#headphones_indexer");
- initConfigCheckbox("#usenewznab");
- initConfigCheckbox("#usenzbsorg");
- initConfigCheckbox("#useomgwtfnzbs");
- initConfigCheckbox("#usekat");
- initConfigCheckbox("#usepiratebay");
- initConfigCheckbox("#usemininova");
- initConfigCheckbox("#usewaffles");
- initConfigCheckbox("#userutracker");
- initConfigCheckbox("#usewhatcd");
- initConfigCheckbox("#useapi");
+ initConfigCheckbox("#use_newznab");
+ initConfigCheckbox("#use_nzbsorg");
+ initConfigCheckbox("#use_omgwtfnzbs");
+ initConfigCheckbox("#use_kat");
+ initConfigCheckbox("#use_piratebay");
+ initConfigCheckbox("#use_mininova");
+ initConfigCheckbox("#use_waffles");
+ initConfigCheckbox("#use_rutracker");
+ initConfigCheckbox("#use_whatcd");
+ initConfigCheckbox("#api_enabled");
initConfigCheckbox("#enable_https");
diff --git a/headphones/config.py b/headphones/config.py
index 58e895c9..e20ea9c1 100644
--- a/headphones/config.py
+++ b/headphones/config.py
@@ -318,8 +318,10 @@ class Config(object):
def add_extra_newznab(self, newznab):
""" Add a new extra newznab """
+ extra_newznabs = self.EXTRA_NEWZNABS
for item in newznab:
- self.EXTRA_NEWZNABS.append(item)
+ extra_newznabs.append(item)
+ self.EXTRA_NEWZNABS = extra_newznabs
def __getattr__(self, name):
"""
diff --git a/headphones/searcher.py b/headphones/searcher.py
index 799cbb7e..281dec33 100644
--- a/headphones/searcher.py
+++ b/headphones/searcher.py
@@ -153,17 +153,17 @@ def get_seed_ratio(provider):
"""
if provider == 'rutracker.org':
- seed_ratio = headphones.RUTRACKER_RATIO
+ seed_ratio = headphones.CONFIG.RUTRACKER_RATIO
elif provider == 'Kick Ass Torrents':
- seed_ratio = headphones.KAT_RATIO
+ seed_ratio = headphones.CONFIG.KAT_RATIO
elif provider == 'What.cd':
- seed_ratio = headphones.WHATCD_RATIO
+ seed_ratio = headphones.CONFIG.WHATCD_RATIO
elif provider == 'The Pirate Bay':
- seed_ratio = headphones.PIRATEBAY_RATIO
+ seed_ratio = headphones.CONFIG.PIRATEBAY_RATIO
elif provider == 'Waffles.fm':
- seed_ratio = headphones.WAFFLES_RATIO
+ seed_ratio = headphones.CONFIG.WAFFLES_RATIO
elif provider == 'Mininova':
- seed_ratio = headphones.MININOVA_RATIO
+ seed_ratio = headphones.CONFIG.MININOVA_RATIO
else:
seed_ratio = None
diff --git a/headphones/webserve.py b/headphones/webserve.py
index af153edd..9aa9b326 100644
--- a/headphones/webserve.py
+++ b/headphones/webserve.py
@@ -1166,18 +1166,45 @@ class WebInterface(object):
def configUpdate(self, **kwargs):
# Handle the variable config options. Note - keys with False values aren't getting passed
- headphones.CONFIG.clear_extra_newznabs()
- for kwarg in kwargs:
- if kwarg.startswith('newznab_host'):
- newznab_number = kwarg[12:]
- if len(newznab_number):
- newznab_host = kwargs.get('newznab_host' + newznab_number)
- newznab_api = kwargs.get('newznab_api' + newznab_number)
- try:
- newznab_enabled = int(kwargs.get('newznab_enabled' + newznab_number))
- except KeyError:
- newznab_enabled = 0
- headphones.CONFIG.add_extra_newznab((newznab_host, newznab_api, newznab_enabled))
+
+ checked_configs = [
+ "launch_browser", "enable_https", "api_enabled", "use_blackhole", "headphones_indexer", "use_newznab", "newznab_enabled",
+ "use_nzbsorg", "use_omgwtfnzbs", "use_kat", "use_piratebay", "use_mininova", "use_waffles", "use_rutracker", "use_whatcd",
+ "preferred_bitrate_allow_lossless", "detect_bitrate", "freeze_db", "move_files", "rename_files", "correct_metadata",
+ "cleanup_files", "keep_nfo", "add_album_art", "embed_album_art", "embed_lyrics", "replace_existing_folders", "file_underscores",
+ "include_extras", "autowant_upcoming", "autowant_all", "autowant_manually_added", "keep_torrent_files", "music_encoder",
+ "encoderlossless", "encoder_multicore", "delete_lossless_files", "growl_enabled", "growl_onsnatch", "prowl_enabled",
+ "prowl_onsnatch", "xbmc_enabled", "xbmc_update", "xbmc_notify", "lms_enabled", "plex_enabled", "plex_update", "plex_notify",
+ "nma_enabled", "nma_onsnatch", "pushalot_enabled", "pushalot_onsnatch", "synoindex_enabled", "pushover_enabled",
+ "pushover_onsnatch", "pushbullet_enabled", "pushbullet_onsnatch", "subsonic_enabled", "twitter_enabled", "twitter_onsnatch",
+ "osx_notify_enabled", "osx_notify_onsnatch", "boxcar_enabled", "boxcar_onsnatch", "songkick_enabled", "songkick_filter_enabled",
+ "mpc_enabled"
+ ]
+ for checked_config in checked_configs:
+ if checked_config not in kwargs:
+ # checked items should be zero or one. if they were not sent then the item was not checked
+ kwargs[checked_config] = 0
+
+ for plain_config, use_config in [(x[4:], x) for x in kwargs if x.startswith('use_')]:
+ # the use prefix is fairly nice in the html, but does not match the actual config
+ kwargs[plain_config] = kwargs[use_config]
+ del kwargs[use_config]
+
+ extra_newznabs = []
+ for kwarg in [x for x in kwargs if x.startswith('newznab_host')]:
+ newznab_host_key = kwarg
+ newznab_number = kwarg[12:]
+ if len(newznab_number):
+ newznab_api_key = 'newznab_api' + newznab_number
+ newznab_enabled_key = 'newznab_enabled' + newznab_number
+ newznab_host = kwargs.get(newznab_host_key, '')
+ newznab_api = kwargs.get(newznab_api_key, '')
+ newznab_enabled = int(kwargs.get(newznab_enabled_key, 0))
+ for key in [newznab_host_key, newznab_api_key, newznab_enabled_key]:
+ if key in kwargs:
+ del kwargs[key]
+ extra_newznabs.append((newznab_host, newznab_api, newznab_enabled))
+
# Convert the extras to list then string. Coming in as 0 or 1 (append new extras to the end)
temp_extras_list = []
@@ -1204,8 +1231,10 @@ class WebInterface(object):
del kwargs[extra]
headphones.CONFIG.EXTRAS = ','.join(str(n) for n in temp_extras_list)
-
+ headphones.CONFIG.clear_extra_newznabs()
headphones.CONFIG.process_kwargs(kwargs)
+ for extra_newznab in extra_newznabs:
+ headphones.CONFIG.add_extra_newznab(extra_newznab)
# Sanity checking
if headphones.CONFIG.SEARCH_INTERVAL < 360: