]> git.lizzy.rs Git - nhentai.git/commitdiff
use dict.update to update config values
authorRicterZ <ricterzheng@gmail.com>
Thu, 26 Nov 2020 09:52:10 +0000 (17:52 +0800)
committerRicterZ <ricterzheng@gmail.com>
Thu, 26 Nov 2020 09:52:10 +0000 (17:52 +0800)
nhentai/cmdline.py
nhentai/constant.py

index 59dadac91c1167dba4f12d4a34c04c123b329a7d..532beb424384b1135ca3e5b5a464acf33aeabdbe 100644 (file)
@@ -43,7 +43,7 @@ def load_config():
 
     try:
         with open(constant.NHENTAI_CONFIG_FILE, 'r') as f:
-            constant.CONFIG = json.load(f)
+            constant.CONFIG.update(json.load(f))
     except json.JSONDecodeError:
         logger.error('Failed to load config file.')
         write_config()
index e27765e17918cd1e9e4779fe7a3829a7c3ed5fa3..7d8df2fef11190ea81b3bebc95d2c897fc021dcf 100644 (file)
@@ -1,6 +1,7 @@
 # coding: utf-8
 from __future__ import unicode_literals, print_function
 import os
+import copy
 import tempfile
 
 try:
@@ -29,10 +30,10 @@ NHENTAI_HOME = os.path.join(os.getenv('HOME', tempfile.gettempdir()), '.nhentai'
 NHENTAI_HISTORY = os.path.join(NHENTAI_HOME, 'history.sqlite3')
 NHENTAI_CONFIG_FILE = os.path.join(NHENTAI_HOME, 'config.json')
 
+
 CONFIG = {
     'proxy': {},
     'cookie': '',
     'language': '',
     'template': '',
 }
-