diff --git a/bazarr/config.py b/bazarr/config.py index 2d3405f04..db2afd358 100644 --- a/bazarr/config.py +++ b/bazarr/config.py @@ -41,7 +41,8 @@ defaults = { 'subfolder_custom': '', 'upgrade_subs': 'True', 'days_to_upgrade_subs': '7', - 'upgrade_manual': 'True' + 'upgrade_manual': 'True', + 'anti_captcha_provider': 'anti-captcha' }, 'auth': { 'type': 'None', @@ -98,7 +99,15 @@ defaults = { }, 'assrt': { 'token': '' - }} + }, + 'anticaptcha': { + 'anti_captcha_key': '' + }, + 'deathbycaptcha': { + 'username': '', + 'password': '' + } +} settings = simpleconfigparser(defaults=defaults) settings.read(os.path.join(args.config_dir, 'config', 'config.ini')) diff --git a/bazarr/init.py b/bazarr/init.py index 7c13cc24d..eb3af0ce3 100644 --- a/bazarr/init.py +++ b/bazarr/init.py @@ -17,9 +17,6 @@ from get_args import args # set subliminal_patch user agent os.environ["SZ_USER_AGENT"] = "Bazarr/1" -# set anticaptcha account key -os.environ["ANTICAPTCHA_ACCOUNT_KEY"] = settings.general.anticaptcha_key - # Check if args.config_dir exist if not os.path.exists(args.config_dir): # Create config_dir directory tree diff --git a/views/settings.tpl b/views/settings.tpl index 29072aeff..f6068244e 100644 --- a/views/settings.tpl +++ b/views/settings.tpl @@ -1228,6 +1228,78 @@ + +
Anti-captcha options
+
+
+
+
+ +
+
+ +
+ + +
+ +
+
+
+ +
+
+
+
+ +
+
+
+
+ +
+
+
+ +
+
+
+
+ +
+
+
+
+ +
+
+
+ +
+
+
+
+ +
+
+
+
+
+
+
Subtitles providers
@@ -2235,6 +2307,30 @@ } }); + if ($('#settings_anti_captcha_provider').val() === "None") { + $('.anticaptcha').hide(); + $('.deathbycaptcha').hide(); + } else if ($('#settings_anti_captcha_provider').val() === "anti-captcha") { + $('.anticaptcha').show(); + $('.deathbycaptcha').hide(); + } else if ($('#settings_anti_captcha_provider').val() === "death-by-cCaptcha") { + $('.deathbycaptcha').show(); + $('.anticaptcha').hide(); + } + + $('#settings_anti_captcha_provider').dropdown('setting', 'onChange', function(){ + if ($('#settings_anti_captcha_provider').val() === "None") { + $('.anticaptcha').hide(); + $('.deathbycaptcha').hide(); + } else if ($('#settings_anti_captcha_provider').val() === "anti-captcha") { + $('.anticaptcha').show(); + $('.deathbycaptcha').hide(); + } else if ($('#settings_anti_captcha_provider').val() === "death-by-captcha") { + $('.deathbycaptcha').show(); + $('.anticaptcha').hide(); + } + }); + if ($('#settings_use_postprocessing').data("postprocessing") === "True") { $('.postprocessing').show(); } else { @@ -2445,6 +2541,8 @@ $('#settings_page_size').dropdown('set selected','{{!settings.general.page_size}}'); $('#settings_subfolder').dropdown('clear'); $('#settings_subfolder').dropdown('set selected', '{{!settings.general.subfolder}}'); + $('#settings_anti_captcha_provider').dropdown('clear'); + $('#settings_anti_captcha_provider').dropdown('set selected', '{{!settings.general.anti_captcha_provider}}'); $('#settings_proxy_type').dropdown('clear'); $('#settings_proxy_type').dropdown('set selected','{{!settings.proxy.type}}'); $('#settings_providers').dropdown('clear');