mirror of
https://github.com/kemayo/leech
synced 2025-12-07 17:05:25 +01:00
Adjust option loading so it's easier to override
This commit is contained in:
parent
91d2c4fd4b
commit
2f21280d76
1 changed files with 6 additions and 7 deletions
13
leech.py
13
leech.py
|
|
@ -58,20 +58,19 @@ def load_on_disk_options(site):
|
||||||
with open('leech.json') as store_file:
|
with open('leech.json') as store_file:
|
||||||
store = json.load(store_file)
|
store = json.load(store_file)
|
||||||
login = store.get('logins', {}).get(site.site_key(), False)
|
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', {})
|
cover_options = store.get('cover', {})
|
||||||
image_options = store.get('images', {})
|
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:
|
except FileNotFoundError:
|
||||||
logger.info("Unable to locate leech.json. Continuing assuming it does not exist.")
|
logger.info("Unable to locate leech.json. Continuing assuming it does not exist.")
|
||||||
login = False
|
login = False
|
||||||
configured_site_options = {}
|
|
||||||
image_options = {}
|
image_options = {}
|
||||||
cover_options = {}
|
cover_options = {}
|
||||||
output_dir = False
|
consolidated_options = {}
|
||||||
if output_dir and 'output_dir' not in configured_site_options:
|
return consolidated_options, login, cover_options, image_options
|
||||||
configured_site_options['output_dir'] = output_dir
|
|
||||||
return configured_site_options, login, cover_options, image_options
|
|
||||||
|
|
||||||
|
|
||||||
def create_options(site, site_options, unused_flags):
|
def create_options(site, site_options, unused_flags):
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue