mirror of
				https://github.com/RicterZ/nhentai.git
				synced 2025-11-04 02:50:55 +01:00 
			
		
		
		
	use dict.update to update config values
This commit is contained in:
		@@ -43,7 +43,7 @@ def load_config():
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    try:
 | 
					    try:
 | 
				
			||||||
        with open(constant.NHENTAI_CONFIG_FILE, 'r') as f:
 | 
					        with open(constant.NHENTAI_CONFIG_FILE, 'r') as f:
 | 
				
			||||||
            constant.CONFIG = json.load(f)
 | 
					            constant.CONFIG.update(json.load(f))
 | 
				
			||||||
    except json.JSONDecodeError:
 | 
					    except json.JSONDecodeError:
 | 
				
			||||||
        logger.error('Failed to load config file.')
 | 
					        logger.error('Failed to load config file.')
 | 
				
			||||||
        write_config()
 | 
					        write_config()
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,7 @@
 | 
				
			|||||||
# coding: utf-8
 | 
					# coding: utf-8
 | 
				
			||||||
from __future__ import unicode_literals, print_function
 | 
					from __future__ import unicode_literals, print_function
 | 
				
			||||||
import os
 | 
					import os
 | 
				
			||||||
 | 
					import copy
 | 
				
			||||||
import tempfile
 | 
					import tempfile
 | 
				
			||||||
 | 
					
 | 
				
			||||||
try:
 | 
					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_HISTORY = os.path.join(NHENTAI_HOME, 'history.sqlite3')
 | 
				
			||||||
NHENTAI_CONFIG_FILE = os.path.join(NHENTAI_HOME, 'config.json')
 | 
					NHENTAI_CONFIG_FILE = os.path.join(NHENTAI_HOME, 'config.json')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
CONFIG = {
 | 
					CONFIG = {
 | 
				
			||||||
    'proxy': {},
 | 
					    'proxy': {},
 | 
				
			||||||
    'cookie': '',
 | 
					    'cookie': '',
 | 
				
			||||||
    'language': '',
 | 
					    'language': '',
 | 
				
			||||||
    'template': '',
 | 
					    'template': '',
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user