Refactor get_config_dict function in chrome_tixcraft.py for improved readability and code organization
parent
163810e01a
commit
0c8a44c447
|
@ -142,8 +142,7 @@ def get_config_dict(args):
|
|||
config_filepath = os.path.join(app_root, CONST_MAXBOT_CONFIG_FILE)
|
||||
|
||||
# allow assign config by command line.
|
||||
if not args.input is None:
|
||||
if len(args.input) > 0:
|
||||
if args.input:
|
||||
config_filepath = args.input
|
||||
|
||||
config_dict = None
|
||||
|
@ -152,42 +151,33 @@ def get_config_dict(args):
|
|||
with open(config_filepath) as json_data:
|
||||
config_dict = json.load(json_data)
|
||||
|
||||
if not args.headless is None:
|
||||
if args.headless is not None:
|
||||
config_dict["advanced"]["headless"] = util.t_or_f(args.headless)
|
||||
|
||||
if not args.homepage is None:
|
||||
if len(args.homepage) > 0:
|
||||
if args.homepage:
|
||||
config_dict["homepage"] = args.homepage
|
||||
|
||||
if not args.ticket_number is None:
|
||||
if args.ticket_number > 0:
|
||||
if args.ticket_number:
|
||||
config_dict["ticket_number"] = args.ticket_number
|
||||
|
||||
if not args.browser is None:
|
||||
if len(args.browser) > 0:
|
||||
if args.browser:
|
||||
config_dict["browser"] = args.browser
|
||||
|
||||
if not args.tixcraft_sid is None:
|
||||
if len(args.tixcraft_sid) > 0:
|
||||
if args.tixcraft_sid:
|
||||
config_dict["advanced"]["tixcraft_sid"] = args.tixcraft_sid
|
||||
|
||||
if not args.ibonqware is None:
|
||||
if len(args.ibonqware) > 0:
|
||||
if args.ibonqware:
|
||||
config_dict["advanced"]["ibonqware"] = args.ibonqware
|
||||
|
||||
if not args.kktix_account is None:
|
||||
if len(args.kktix_account) > 0:
|
||||
if args.kktix_account:
|
||||
config_dict["advanced"]["kktix_account"] = args.kktix_account
|
||||
if not args.kktix_password is None:
|
||||
if len(args.kktix_password) > 0:
|
||||
if args.kktix_password:
|
||||
config_dict["advanced"]["kktix_password_plaintext"] = args.kktix_password
|
||||
|
||||
if not args.proxy_server is None:
|
||||
if len(args.proxy_server) > 2:
|
||||
if args.proxy_server:
|
||||
config_dict["advanced"]["proxy_server_port"] = args.proxy_server
|
||||
|
||||
if not args.window_size is None:
|
||||
if len(args.window_size) > 2:
|
||||
if args.window_size:
|
||||
config_dict["advanced"]["window_size"] = args.window_size
|
||||
|
||||
# special case for headless to enable away from keyboard mode.
|
||||
|
|
Loading…
Reference in New Issue