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

Adjust option loading so it's easier to override

This commit is contained in:
David Lynch 2024-11-30 14:05:53 -06:00
parent 91d2c4fd4b
commit 2f21280d76

View file

@ -58,20 +58,19 @@ def load_on_disk_options(site):
with open('leech.json') as store_file:
store = json.load(store_file)
login = store.get('logins', {}).get(site.site_key(), False)
configured_site_options = store.get('site_options', {}).get(site.site_key(), {})
cover_options = store.get('cover', {})
image_options = store.get('images', {})
output_dir = store.get('output_dir', False)
consolidated_options = {
**{k: v for k, v in store.items() if k not in ('cover', 'images', 'logins')},
**store.get('site_options', {}).get(site.site_key(), {})
}
except FileNotFoundError:
logger.info("Unable to locate leech.json. Continuing assuming it does not exist.")
login = False
configured_site_options = {}
image_options = {}
cover_options = {}
output_dir = False
if output_dir and 'output_dir' not in configured_site_options:
configured_site_options['output_dir'] = output_dir
return configured_site_options, login, cover_options, image_options
consolidated_options = {}
return consolidated_options, login, cover_options, image_options
def create_options(site, site_options, unused_flags):