From ea3fb9e1d0a728b4a754bd5d8299a303d2002c9f Mon Sep 17 00:00:00 2001 From: Kazuki Suzuki Przyborowski Date: Fri, 24 Jan 2025 13:58:34 -0600 Subject: [PATCH] Another update --- catfile.ini | 1 + pycatfile.py | 15 ++++++++------- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/catfile.ini b/catfile.ini index 055f505..fbcacc0 100644 --- a/catfile.ini +++ b/catfile.ini @@ -2,6 +2,7 @@ [config] default = CatFile +proname = PyCatFile [CatFile] len = 7 diff --git a/pycatfile.py b/pycatfile.py index 95f496a..8613e0f 100755 --- a/pycatfile.py +++ b/pycatfile.py @@ -284,6 +284,7 @@ def get_default_threads(): __use_http_lib__ = "urllib" __file_format_multi_dict__ = {} __file_format_default__ = "CatFile" +__program_name__ = "Py".__file_format_default__ if os.path.exists(__config_file__) and __use_ini_file__: config = configparser.ConfigParser() config.read(__config_file__) @@ -293,23 +294,23 @@ def decode_unicode_escape(value): else: # Python 3 return bytes(value, 'UTF-8').decode('unicode_escape') __file_format_default__ = decode_unicode_escape(config.get('config', 'default')) + __program_name__ = decode_unicode_escape(config.get('config', 'proname')) # Loop through all sections for section in config.sections(): required_keys = [ - "len", "hex", "ver", "name", "proname", - "lower", "magic", "delimiter", "extension", + "len", "hex", "ver", "name", "lower", + "magic", "delimiter", "extension", "newstyle", "advancedlist", "altinode" ] if all(key in config[section] for key in required_keys): - __file_format_multi_dict__.update({decode_unicode_escape(config.get(section, 'magic')): {'format_name': config.get(section, 'name'), 'format_magic': decode_unicode_escape(config.get(section, 'magic')), 'format_lower': config.get(section, 'lower'), 'format_len': config.getint(section, 'len'), 'format_hex': config.get(section, 'hex'), 'format_delimiter': decode_unicode_escape(config.get(section, 'delimiter')), 'format_ver': config.get(section, 'ver'), 'new_style': config.getboolean(section, 'newstyle'), 'use_advanced_list': config.getboolean(section, 'advancedlist'), 'use_alt_inode': config.getboolean(section, 'altinode'), 'format_extension': decode_unicode_escape(config.get(section, 'extension')), 'program_name': decode_unicode_escape(config.get(section, 'proname'))} } ) + __file_format_multi_dict__.update({decode_unicode_escape(config.get(section, 'magic')): {'format_name': config.get(section, 'name'), 'format_magic': decode_unicode_escape(config.get(section, 'magic')), 'format_lower': config.get(section, 'lower'), 'format_len': config.getint(section, 'len'), 'format_hex': config.get(section, 'hex'), 'format_delimiter': decode_unicode_escape(config.get(section, 'delimiter')), 'format_ver': config.get(section, 'ver'), 'new_style': config.getboolean(section, 'newstyle'), 'use_advanced_list': config.getboolean(section, 'advancedlist'), 'use_alt_inode': config.getboolean(section, 'altinode'), 'format_extension': decode_unicode_escape(config.get(section, 'extension')) } } ) if("CatFile" not in __file_format_multi_dict__): - __file_format_multi_dict__.update({'CatFile': {'format_name': "CatFile", 'format_magic': "CatFile", 'format_lower': "catfile", 'format_len': 7, 'format_hex': "43617446696c65", 'format_delimiter': "\x00", 'format_ver': "001", 'new_style': True, 'use_advanced_list': True, 'use_alt_inode': False, 'format_extension': ".cat", 'program_name': "PyCatFile"} } ) + __file_format_multi_dict__.update({'CatFile': {'format_name': "CatFile", 'format_magic': "CatFile", 'format_lower': "catfile", 'format_len': 7, 'format_hex': "43617446696c65", 'format_delimiter': "\x00", 'format_ver': "001", 'new_style': True, 'use_advanced_list': True, 'use_alt_inode': False, 'format_extension': ".cat" } } ) if("ねこファイル" not in __file_format_multi_dict__): - __file_format_multi_dict__.update({'ねこファイル': {'format_name': "NekoFile", 'format_magic': "ねこファイル", 'format_lower': "nekofile", 'format_len': 21, 'format_hex': "e381ade38193e38395e382a1e382a4e383abe", 'format_delimiter': "\x00", 'format_ver': "001", 'new_style': True, 'use_advanced_list': True, 'use_alt_inode': False, 'format_extension': ".ねこ", 'program_name': "PyNekoFile"} } ) + __file_format_multi_dict__.update({'ねこファイル': {'format_name': "NekoFile", 'format_magic': "ねこファイル", 'format_lower': "nekofile", 'format_len': 21, 'format_hex': "e381ade38193e38395e382a1e382a4e383abe", 'format_delimiter': "\x00", 'format_ver': "001", 'new_style': True, 'use_advanced_list': True, 'use_alt_inode': False, 'format_extension': ".ねこ" } } ) if("네코파일" not in __file_format_multi_dict__): - __file_format_multi_dict__.update({'네코파일': {'format_name': "NekoFile", 'format_magic': "네코파일", 'format_lower': "nekofile", 'format_len': 15, 'format_hex': "eb84a4ecbd94ed8c8c", 'format_delimiter': "\x00", 'format_ver': "001", 'new_style': True, 'use_advanced_list': True, 'use_alt_inode': False, 'format_extension': ".네코", 'program_name': "PyNekoFile"} } ) + __file_format_multi_dict__.update({'네코파일': {'format_name': "NekoFile", 'format_magic': "네코파일", 'format_lower': "nekofile", 'format_len': 15, 'format_hex': "eb84a4ecbd94ed8c8c", 'format_delimiter': "\x00", 'format_ver': "001", 'new_style': True, 'use_advanced_list': True, 'use_alt_inode': False, 'format_extension': ".네코" } } ) __file_format_name__ = __file_format_multi_dict__[__file_format_default__]['format_name'] -__program_name__ = __file_format_multi_dict__[__file_format_default__]['program_name'] __file_format_lower__ = __file_format_multi_dict__[__file_format_default__]['format_lower'] __file_format_magic__ = __file_format_multi_dict__[__file_format_default__]['format_magic'] __file_format_len__ = __file_format_multi_dict__[__file_format_default__]['format_len']