1
0
Fork 0
mirror of https://github.com/kemayo/leech synced 2025-12-06 08:22:56 +01:00

Create empty dict when leech.json not present

This commit is contained in:
Alex Raubach 2018-09-15 11:03:52 -04:00
parent 0c37727219
commit 60084534a8
2 changed files with 3 additions and 2 deletions

View file

@ -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)

View file

@ -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