Skip to content

Commit ea3fb9e

Browse files
author
Kazuki Suzuki Przyborowski
committed
Another update
1 parent 724126f commit ea3fb9e

2 files changed

Lines changed: 9 additions & 7 deletions

File tree

catfile.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
[config]
44
default = CatFile
5+
proname = PyCatFile
56

67
[CatFile]
78
len = 7

pycatfile.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,7 @@ def get_default_threads():
284284
__use_http_lib__ = "urllib"
285285
__file_format_multi_dict__ = {}
286286
__file_format_default__ = "CatFile"
287+
__program_name__ = "Py".__file_format_default__
287288
if os.path.exists(__config_file__) and __use_ini_file__:
288289
config = configparser.ConfigParser()
289290
config.read(__config_file__)
@@ -293,23 +294,23 @@ def decode_unicode_escape(value):
293294
else: # Python 3
294295
return bytes(value, 'UTF-8').decode('unicode_escape')
295296
__file_format_default__ = decode_unicode_escape(config.get('config', 'default'))
297+
__program_name__ = decode_unicode_escape(config.get('config', 'proname'))
296298
# Loop through all sections
297299
for section in config.sections():
298300
required_keys = [
299-
"len", "hex", "ver", "name", "proname",
300-
"lower", "magic", "delimiter", "extension",
301+
"len", "hex", "ver", "name", "lower",
302+
"magic", "delimiter", "extension",
301303
"newstyle", "advancedlist", "altinode"
302304
]
303305
if all(key in config[section] for key in required_keys):
304-
__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'))} } )
306+
__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')) } } )
305307
if("CatFile" not in __file_format_multi_dict__):
306-
__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"} } )
308+
__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" } } )
307309
if("ねこファイル" not in __file_format_multi_dict__):
308-
__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"} } )
310+
__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': ".ねこ" } } )
309311
if("네코파일" not in __file_format_multi_dict__):
310-
__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"} } )
312+
__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': ".네코" } } )
311313
__file_format_name__ = __file_format_multi_dict__[__file_format_default__]['format_name']
312-
__program_name__ = __file_format_multi_dict__[__file_format_default__]['program_name']
313314
__file_format_lower__ = __file_format_multi_dict__[__file_format_default__]['format_lower']
314315
__file_format_magic__ = __file_format_multi_dict__[__file_format_default__]['format_magic']
315316
__file_format_len__ = __file_format_multi_dict__[__file_format_default__]['format_len']

0 commit comments

Comments
 (0)