feat(toolbox): 支持rar格式与7z格式解压,修改了下注释

This commit is contained in:
JasonGuo1 2023-03-30 15:45:58 +08:00
parent a7c857d4d9
commit 5381df8f35
2 changed files with 3 additions and 0 deletions

View File

@ -14,6 +14,7 @@ if USE_PROXY:
# 代理网络的地址,打开你的科学上网软件查看代理的协议(socks5/http)、地址(localhost)和端口(11284) # 代理网络的地址,打开你的科学上网软件查看代理的协议(socks5/http)、地址(localhost)和端口(11284)
proxies = { "http": "socks5h://localhost:11284", "https": "socks5h://localhost:11284", } proxies = { "http": "socks5h://localhost:11284", "https": "socks5h://localhost:11284", }
print('网络代理状态:运行。') print('网络代理状态:运行。')
else: else:
proxies = None proxies = None

View File

@ -193,11 +193,13 @@ def extract_archive(file_path, dest_dir):
print("Successfully extracted rar archive to {}".format(dest_dir)) print("Successfully extracted rar archive to {}".format(dest_dir))
except: except:
print("rar格式需要安装额外依赖") print("rar格式需要安装额外依赖")
elif file_extension == '.7z': elif file_extension == '.7z':
try: try:
import py7zr import py7zr
with py7zr.SevenZipFile(file_path, mode='r') as f: with py7zr.SevenZipFile(file_path, mode='r') as f:
f.extractall(path=dest_dir) f.extractall(path=dest_dir)
print("Successfully extracted 7z archive to {}".format(dest_dir))
except: except:
print("7z格式需要安装额外依赖") print("7z格式需要安装额外依赖")
else: else: