add compress fold

This commit is contained in:
13339479676 2022-01-25 20:58:44 +08:00
parent e76964f1f9
commit d4d52ee906
2 changed files with 9 additions and 3 deletions

1
.gitignore vendored
View File

@ -22,6 +22,7 @@ __pycache__
*.tar
*.tar.gz
*.rar
/compress
test.py
/log

View File

@ -8,11 +8,16 @@ import sys
import os
from tqdm import tqdm
import time
from pathlib import Path
from utils.time_format import time_format
from utils.ows_path import increment_path
ROOT_PATH = sys.path[0] # 项目根目录
COMPRESS_SUFFIX = ['zip', 'tar'] # 压缩文件格式
# 帧保存路径管理
COMPRESS_PATH = increment_path(
Path(f"./compress") / "compress", exist_ok=False) # 增量运行
COMPRESS_PATH.mkdir(parents=True, exist_ok=True) # 创建目录
# 判断压缩文件格式
def is_compressFile(compressStyle):
@ -27,9 +32,9 @@ def webcam_compress(compressStyle, is_autoCompressName, compressName, preCompres
# 自动命名
compressNameTmp = str(preCompressFilePath).split('/')[-1] # 获取帧目录名称
# 自动命名压缩文件名称
compressName = f'{ROOT_PATH}/{compressNameTmp}.{compressStyle}'
compressName = f'{COMPRESS_PATH}/{compressNameTmp}.{compressStyle}'
else:
compressName = f'{ROOT_PATH}/{compressName}.{compressStyle}' # 自定义命名
compressName = f'{COMPRESS_PATH}/{compressName}.{compressStyle}' # 自定义命名
file_list = os.listdir(preCompressFilePath) # 获取目录下的文件名称
file_tqdm = tqdm(file_list) # 获取进度条