v04 update 02

This commit is contained in:
13339479676 2022-01-20 16:40:31 +08:00
parent 349ea1774c
commit 5788a760bc
1 changed files with 6 additions and 2 deletions

View File

@ -7,12 +7,13 @@ import tarfile
import sys
import os
from tqdm import tqdm
import time
ROOT_PATH = sys.path[0] # 项目根目录
COMPRESS_SUFFIX = ['zip', 'tar'] # 压缩文件格式
# 判断压缩文件名称
# 判断压缩文件格式
def is_compressFile(compressStyle):
if compressStyle not in COMPRESS_SUFFIX:
print(f'{compressStyle}:不正确!程序退出!')
@ -31,6 +32,7 @@ def webcam_compress(compressStyle, is_autoCompressName, compressName, preCompres
file_tqdm = tqdm(file_list) # 获取进度条
# ----------压缩开始----------
compress_startTime = time.time() # 压缩开始时间
if (compressStyle == COMPRESS_SUFFIX[0]):
# zip压缩
compress_file = zipfile.ZipFile(compressName, compressMode)
@ -49,4 +51,6 @@ def webcam_compress(compressStyle, is_autoCompressName, compressName, preCompres
# ----------压缩结束----------
compress_file.close()
print(f'文件压缩成功!已保存在:{compressName}')
compress_endTime = time.time() # 压缩结束时间
compress_totalTime = compress_endTime - compress_startTime
print(f'文件压缩成功!用时:{compress_totalTime}s已保存在{compressName}')