diff --git a/gallery_dl/config.py b/gallery_dl/config.py index 88fede98..e0bfa48f 100644 --- a/gallery_dl/config.py +++ b/gallery_dl/config.py @@ -12,6 +12,7 @@ import sys import json import os.path import logging +from . import util log = logging.getLogger("config") @@ -57,7 +58,10 @@ def load(*files, format="json", strict=False): path = os.path.expanduser(os.path.expandvars(conf)) with open(path) as file: confdict = parsefunc(file) - _config.update(confdict) + if not _config: + _config.update(confdict) + else: + util.combine_dict(_config, confdict) except FileNotFoundError: if strict: log.error("Configuration file '%s' not found", path) diff --git a/gallery_dl/extractor/deviantart.py b/gallery_dl/extractor/deviantart.py index c52ac74f..7f48736b 100644 --- a/gallery_dl/extractor/deviantart.py +++ b/gallery_dl/extractor/deviantart.py @@ -311,7 +311,7 @@ class DeviantartJournalExtractor(DeviantartExtractor): r"/(?:journal|blog)/?(?:\?catpath=/)?$"] test = [ ("http://shimoda7.deviantart.com/journal/", { - "url": "f7960ae06e774d6931c61ad309c95a10710658b2", + "url": "b1a3460e7da0f34c8f6c286a3b5428fd4d3bc64b", "keyword": "6444966c703e63470a5fdd8f460993b68955c32c", }), ("http://shimoda7.deviantart.com/journal/?catpath=/", None), diff --git a/gallery_dl/util.py b/gallery_dl/util.py index 98342cba..663f868a 100644 --- a/gallery_dl/util.py +++ b/gallery_dl/util.py @@ -80,6 +80,15 @@ def bdecode(data, alphabet="0123456789"): return num +def combine_dict(a, b): + """Recursively combine the contents of b into a""" + for key, value in b.items(): + if key in a and isinstance(value, dict) and isinstance(a[key], dict): + combine_dict(a[key], value) + else: + a[key] = value + + def code_to_language(code, default=None): """Map an ISO 639-1 language code to its actual name""" return CODES.get((code or "").lower(), default)