diff --git a/calibre-plugin/jobs.py b/calibre-plugin/jobs.py index 84a82375..917539a5 100644 --- a/calibre-plugin/jobs.py +++ b/calibre-plugin/jobs.py @@ -4,7 +4,7 @@ from __future__ import (unicode_literals, division, absolute_import, print_function) __license__ = 'GPL v3' -__copyright__ = '2014, Jim Miller' +__copyright__ = '2015, Jim Miller' __copyright__ = '2011, Grant Drake ' __docformat__ = 'restructuredtext en' @@ -112,7 +112,15 @@ def do_download_for_worker(book,options,notification=lambda x,y:x): configuration = get_ffdl_config(book['url'], options['fileform'], options['personal.ini']) - + + if configuration.getConfig('use_ssl_unverified_context'): + ## monkey patch to avoid SSL bug. dupliated from + ## ffdl_plugin.py because bg jobs run in own process + ## space. + import ssl + if hasattr(ssl, '_create_unverified_context'): + ssl._create_default_https_context = ssl._create_unverified_context + if not options['updateepubcover'] and 'epub_for_update' in book and options['collision'] in (UPDATE, UPDATEALWAYS): configuration.set("overrides","never_make_cover","true") diff --git a/fanficdownloader/configurable.py b/fanficdownloader/configurable.py index 82a73e2f..89617f14 100644 --- a/fanficdownloader/configurable.py +++ b/fanficdownloader/configurable.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright 2014 Fanficdownloader team +# Copyright 2015 Fanficdownloader team # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -94,6 +94,8 @@ def get_valid_set_options(): 'strip_chapter_numbers':(None,None,boollist), 'titlepage_use_table':(None,None,boollist), + 'use_ssl_unverified_context':(None,None,boollist), + 'add_chapter_numbers':(None,None,boollist+['toconly']), 'check_next_chapter':(['fanfiction.net'],None,boollist), @@ -253,6 +255,7 @@ def get_valid_keywords(): 'tocpage_start', 'tweak_fg_sleep', 'universe_as_series', + 'use_ssl_unverified_context', 'user_agent', 'username', 'website_encodings',