Optimize error output & adjust code sequence

This commit is contained in:
yoshiko2
2021-12-02 02:00:54 +08:00
parent 5525aacae3
commit 1604f0567f
2 changed files with 31 additions and 21 deletions

View File

@@ -469,26 +469,13 @@ def main():
print('[*]' + version.center(54))
print('[*]======================================================')
print('[*]' + platform_total)
print('[*]================= 严禁在墙内宣传本项目 ===================')
print('[*]======================================================')
print('[*] - 严禁在墙内宣传本项目 - ')
print('[*]======================================================')
start_time = time.time()
print('[+]Start at', time.strftime("%Y-%m-%d %H:%M:%S"))
if conf.update_check():
check_update(version)
# Download Mapping Table, parallel version
def fmd(f):
return ('https://raw.githubusercontent.com/yoshiko2/AV_Data_Capture/master/MappingTable/' + f,
Path.home() / '.local' / 'share' / 'avdc' / f)
map_tab = (fmd('mapping_actor.xml'), fmd('mapping_info.xml'), fmd('c_number.json'))
res = parallel_download_files(((k, v) for k, v in map_tab if not v.exists()))
for i, fp in enumerate(res, start=1):
if fp and len(fp):
print(f"[+] [{i}/{len(res)}] Mapping Table Downloaded to {fp}")
else:
print(f"[-] [{i}/{len(res)}] Mapping Table Download failed")
print(f"[+]Load Config file '{conf.ini_path}'.")
if conf.debug():
print('[+]Enable debug')
@@ -504,8 +491,24 @@ def main():
) if not single_file_path else ('-','Single File', '','',''))
)
if conf.update_check():
check_update(version)
create_failed_folder(conf.failed_folder())
# Download Mapping Table, parallel version
def fmd(f):
return ('https://raw.githubusercontent.com/yoshiko2/AV_Data_Capture/master/MappingTable/' + f,
Path.home() / '.local' / 'share' / 'avdc' / f)
map_tab = (fmd('mapping_actor.xml'), fmd('mapping_info.xml'), fmd('c_number.json'))
res = parallel_download_files(((k, v) for k, v in map_tab if not v.exists()))
for i, fp in enumerate(res, start=1):
if fp and len(fp):
print(f"[+] [{i}/{len(res)}] Mapping Table Downloaded to {fp}")
else:
print(f"[-] [{i}/{len(res)}] Mapping Table Download failed")
# create OpenCC converter
ccm = conf.cc_convert_mode()
try: