readme update
This commit is contained in:
parent
43bcd9a316
commit
7827db4f59
|
@ -265,11 +265,12 @@ python opencv_webcam.py -lm w # 设置为覆盖模式
|
|||
# 常规压缩,默认test.zip(以自动版为例)
|
||||
python opencv_webcam.py -isasf -isc
|
||||
# 自定义压缩文件名称
|
||||
python opencv_webcam.py -isasf -isc -zn test02.zip
|
||||
python opencv_webcam.py -isasf -isc -cn test02
|
||||
# 自动命名压缩文件
|
||||
python opencv_webcam.py -isasf -isc -isazn
|
||||
python opencv_webcam.py -isasf -isc -isacn
|
||||
# 自定义压缩模式,默认为写覆盖
|
||||
python opencv_webcam.py -isasf -isc -zn test03.zip -zm a # 追加模式
|
||||
python opencv_webcam.py -isasf -isc -cm a # 追加模式(a模式仅限zip)
|
||||
python opencv_webcam.py -isasf -isc -cs tar -cm w:gz # tar压缩
|
||||
```
|
||||
|
||||
|
||||
|
|
|
@ -8,9 +8,9 @@ import sys
|
|||
import os
|
||||
|
||||
ROOT_PATH = sys.path[0] # 项目根目录
|
||||
|
||||
COMPRESS_SUFFIX = ['zip', 'tar']
|
||||
|
||||
|
||||
# 判断压缩文件名称
|
||||
def is_compressFile(compressStyle):
|
||||
if compressStyle not in COMPRESS_SUFFIX:
|
||||
|
@ -29,11 +29,13 @@ def webcam_compress(compressStyle, is_autoCompressName, compressName, preCompres
|
|||
|
||||
# ----------压缩开始----------
|
||||
if (compressStyle == COMPRESS_SUFFIX[0]):
|
||||
# zip压缩
|
||||
compress_file = zipfile.ZipFile(compressName, compressMode)
|
||||
for i in range(len(file_list)):
|
||||
compress_file.write(
|
||||
f'{preCompressFilePath}/{file_list[i]}', compress_type=zipfile.ZIP_DEFLATED)
|
||||
if (compressStyle == COMPRESS_SUFFIX[1]):
|
||||
# tar压缩
|
||||
compress_file = tarfile.open(compressName, compressMode)
|
||||
for i in range(len(file_list)):
|
||||
compress_file.add(f'{preCompressFilePath}/{file_list[i]}')
|
||||
|
|
Loading…
Reference in New Issue