v04 update
This commit is contained in:
parent
54358dd4d4
commit
8a7447cc63
|
@ -6,10 +6,8 @@ import cv2
|
|||
from pathlib import Path
|
||||
import argparse
|
||||
import time
|
||||
import glob
|
||||
import os
|
||||
import sys
|
||||
import yaml
|
||||
from utils.ows_path import increment_path
|
||||
from utils.hotkey import hotkey_judge
|
||||
from utils.frame_opt import frame_opt
|
||||
|
|
|
@ -7,10 +7,9 @@ import tarfile
|
|||
import sys
|
||||
import os
|
||||
from tqdm import tqdm
|
||||
from time import sleep
|
||||
|
||||
ROOT_PATH = sys.path[0] # 项目根目录
|
||||
COMPRESS_SUFFIX = ['zip', 'tar']
|
||||
COMPRESS_SUFFIX = ['zip', 'tar'] # 压缩文件格式
|
||||
|
||||
|
||||
# 判断压缩文件名称
|
||||
|
@ -20,46 +19,16 @@ def is_compressFile(compressStyle):
|
|||
sys.exit()
|
||||
|
||||
|
||||
# # webcam压缩
|
||||
# def webcam_compress(compressStyle, is_autoCompressName, compressName, preCompressFilePath, compressMode):
|
||||
# if (is_autoCompressName):
|
||||
# # 自动命名
|
||||
# compressNameTmp = str(preCompressFilePath).split('/')[-1]
|
||||
# compressName = f'{ROOT_PATH}/{compressNameTmp}.{compressStyle}'
|
||||
|
||||
# file_list = os.listdir(preCompressFilePath) # 获取目录下的文件名称
|
||||
|
||||
# # ----------压缩开始----------
|
||||
# if (compressStyle == COMPRESS_SUFFIX[0]):
|
||||
# # zip压缩
|
||||
# compress_file = zipfile.ZipFile(compressName, compressMode)
|
||||
# for i in range(len(file_list)):
|
||||
# compressing_file = f'{preCompressFilePath}/{file_list[i]}'
|
||||
# # print(f'正在压缩:{compressing_file}')
|
||||
# compress_file.write(
|
||||
# compressing_file, compress_type=zipfile.ZIP_DEFLATED)
|
||||
# if (compressStyle == COMPRESS_SUFFIX[1]):
|
||||
# # tar压缩
|
||||
# compress_file = tarfile.open(compressName, compressMode)
|
||||
# for i in range(len(file_list)):
|
||||
# compressing_file = f'{preCompressFilePath}/{file_list[i]}'
|
||||
# # print(f'正在压缩:{compressing_file}')
|
||||
# compress_file.add(compressing_file)
|
||||
|
||||
# # ----------压缩结束----------
|
||||
# compress_file.close()
|
||||
# print(f'文件压缩成功!已保存在:{compressName}')
|
||||
|
||||
|
||||
# webcam压缩
|
||||
def webcam_compress(compressStyle, is_autoCompressName, compressName, preCompressFilePath, compressMode):
|
||||
if (is_autoCompressName):
|
||||
# 自动命名
|
||||
compressNameTmp = str(preCompressFilePath).split('/')[-1]
|
||||
compressNameTmp = str(preCompressFilePath).split('/')[-1] # 获取帧目录名称
|
||||
# 自动命名压缩文件名称
|
||||
compressName = f'{ROOT_PATH}/{compressNameTmp}.{compressStyle}'
|
||||
|
||||
file_list = os.listdir(preCompressFilePath) # 获取目录下的文件名称
|
||||
file_tqdm = tqdm(file_list)
|
||||
file_tqdm = tqdm(file_list) # 获取进度条
|
||||
|
||||
# ----------压缩开始----------
|
||||
if (compressStyle == COMPRESS_SUFFIX[0]):
|
||||
|
@ -69,14 +38,14 @@ def webcam_compress(compressStyle, is_autoCompressName, compressName, preCompres
|
|||
file_tqdm.set_description(f'正在压缩:{i}')
|
||||
compressing_file = f'{preCompressFilePath}/{i}'
|
||||
compress_file.write(
|
||||
compressing_file, compress_type=zipfile.ZIP_DEFLATED)
|
||||
compressing_file, compress_type=zipfile.ZIP_DEFLATED) # 写入zip文件
|
||||
if (compressStyle == COMPRESS_SUFFIX[1]):
|
||||
# tar压缩
|
||||
compress_file = tarfile.open(compressName, compressMode)
|
||||
for i in file_tqdm:
|
||||
file_tqdm.set_description(f'正在压缩:{i}')
|
||||
compressing_file = f'{preCompressFilePath}/{i}'
|
||||
compress_file.add(compressing_file)
|
||||
compress_file.add(compressing_file) # 写入tar文件
|
||||
|
||||
# ----------压缩结束----------
|
||||
compress_file.close()
|
||||
|
|
Loading…
Reference in New Issue