mirror of
https://github.com/mikf/gallery-dl.git
synced 2024-11-22 02:32:33 +01:00
parent
bced143750
commit
80454460ce
@ -261,13 +261,19 @@ def accumulate(path, key, conf=_config):
|
|||||||
if key in conf:
|
if key in conf:
|
||||||
value = conf[key]
|
value = conf[key]
|
||||||
if value:
|
if value:
|
||||||
|
if isinstance(value, list):
|
||||||
result.extend(value)
|
result.extend(value)
|
||||||
|
else:
|
||||||
|
result.append(value)
|
||||||
for p in path:
|
for p in path:
|
||||||
conf = conf[p]
|
conf = conf[p]
|
||||||
if key in conf:
|
if key in conf:
|
||||||
value = conf[key]
|
value = conf[key]
|
||||||
if value:
|
if value:
|
||||||
|
if isinstance(value, list):
|
||||||
result[:0] = value
|
result[:0] = value
|
||||||
|
else:
|
||||||
|
result.insert(0, value)
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
return result
|
return result
|
||||||
|
@ -619,8 +619,6 @@ class DownloadJob(Job):
|
|||||||
pp_opts = cfg("postprocessor-options")
|
pp_opts = cfg("postprocessor-options")
|
||||||
pp_list = []
|
pp_list = []
|
||||||
|
|
||||||
if isinstance(postprocessors, (dict, str)):
|
|
||||||
postprocessors = (postprocessors,)
|
|
||||||
for pp_dict in postprocessors:
|
for pp_dict in postprocessors:
|
||||||
if isinstance(pp_dict, str):
|
if isinstance(pp_dict, str):
|
||||||
pp_dict = pp_conf.get(pp_dict) or {"name": pp_dict}
|
pp_dict = pp_conf.get(pp_dict) or {"name": pp_dict}
|
||||||
|
@ -117,6 +117,24 @@ class TestConfig(unittest.TestCase):
|
|||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
config.accumulate(("c", "c"), "l"), [5, 6])
|
config.accumulate(("c", "c"), "l"), [5, 6])
|
||||||
|
|
||||||
|
config.set(() , "l", 4)
|
||||||
|
config.set(("c",) , "l", [2, 3])
|
||||||
|
config.set(("c", "c"), "l", 1)
|
||||||
|
self.assertEqual(
|
||||||
|
config.accumulate((), "l") , [4])
|
||||||
|
self.assertEqual(
|
||||||
|
config.accumulate(("c",), "l") , [2, 3, 4])
|
||||||
|
self.assertEqual(
|
||||||
|
config.accumulate(("c", "c"), "l"), [1, 2, 3, 4])
|
||||||
|
|
||||||
|
config.set(("c",), "l", None)
|
||||||
|
self.assertEqual(
|
||||||
|
config.accumulate((), "l") , [4])
|
||||||
|
self.assertEqual(
|
||||||
|
config.accumulate(("c",), "l") , [4])
|
||||||
|
self.assertEqual(
|
||||||
|
config.accumulate(("c", "c"), "l"), [1, 4])
|
||||||
|
|
||||||
def test_set(self):
|
def test_set(self):
|
||||||
config.set(() , "c", [1, 2, 3])
|
config.set(() , "c", [1, 2, 3])
|
||||||
config.set(("b",) , "c", [1, 2, 3])
|
config.set(("b",) , "c", [1, 2, 3])
|
||||||
|
Loading…
Reference in New Issue
Block a user