diff --git a/ebook/__init__.py b/ebook/__init__.py index dbb125b..dddaaa1 100644 --- a/ebook/__init__.py +++ b/ebook/__init__.py @@ -107,7 +107,7 @@ def generate_epub(story, cover_options={}, output_filename=None): # The cover is static, and the only change comes from the image which we generate html = [('Cover', 'cover.html', cover_template)] - if cover_options["cover_url"]: + if cover_options and cover_options["cover_url"]: image = make_cover_from_url(cover_options["cover_url"], story.title, story.author) elif story.cover_url: image = make_cover_from_url(story.cover_url, story.title, story.author) diff --git a/leech.py b/leech.py index d906613..e4314eb 100755 --- a/leech.py +++ b/leech.py @@ -56,11 +56,12 @@ def load_on_disk_options(site): store = json.load(store_file) login = store.get('logins', {}).get(site.__name__, False) configured_site_options = store.get('site_options', {}).get(site.__name__, {}) - cover_options = store.get('cover') + cover_options = store.get('cover', {}) except FileNotFoundError: logger.info("Unable to locate leech.json. Continuing assuming it does not exist.") login = False configured_site_options = {} + cover_options = {} return configured_site_options, login, cover_options