v04 zip
This commit is contained in:
parent
a1bc00e74c
commit
b6625d9cb8
|
@ -15,6 +15,9 @@ from utils.hotkey import hotkey_judge
|
||||||
from utils.frame_opt import frame_opt
|
from utils.frame_opt import frame_opt
|
||||||
from utils.log import is_logSuffix, log_management
|
from utils.log import is_logSuffix, log_management
|
||||||
from utils.args_yaml import argsYaml
|
from utils.args_yaml import argsYaml
|
||||||
|
from utils.compress import webcam_zip
|
||||||
|
|
||||||
|
ROOT_PATH = sys.path[0] # 项目根目录
|
||||||
|
|
||||||
|
|
||||||
def parse_args(known=False):
|
def parse_args(known=False):
|
||||||
|
@ -59,6 +62,11 @@ def parse_args(known=False):
|
||||||
default="test.log", type=str, help='log save name')
|
default="test.log", type=str, help='log save name')
|
||||||
parser.add_argument('--logMode', '-lm',
|
parser.add_argument('--logMode', '-lm',
|
||||||
default="a", type=str, help='log write mode')
|
default="a", type=str, help='log write mode')
|
||||||
|
# 压缩
|
||||||
|
parser.add_argument('--is_compress', '-ic',
|
||||||
|
action='store_true', help='is compress file')
|
||||||
|
parser.add_argument('--zipName', '-zn',
|
||||||
|
default="test.zip", type=str, help='zip save name')
|
||||||
args = parser.parse_known_args()[0] if known else parser.parse_args()
|
args = parser.parse_known_args()[0] if known else parser.parse_args()
|
||||||
return args
|
return args
|
||||||
|
|
||||||
|
@ -82,7 +90,9 @@ def webcam_opencv(device_index="0",
|
||||||
jpg_quality=95,
|
jpg_quality=95,
|
||||||
png_quality=3,
|
png_quality=3,
|
||||||
logName="test.log",
|
logName="test.log",
|
||||||
logMode="a"):
|
logMode="a",
|
||||||
|
is_compress=False,
|
||||||
|
zipName="test.zip"):
|
||||||
|
|
||||||
keyList = [quit_key, frame_capKey, pause_key] # 快捷键列表
|
keyList = [quit_key, frame_capKey, pause_key] # 快捷键列表
|
||||||
hotkey_judge(keyList) # 快捷键冲突判断
|
hotkey_judge(keyList) # 快捷键冲突判断
|
||||||
|
@ -174,6 +184,10 @@ def webcam_opencv(device_index="0",
|
||||||
print(outTimeMsg)
|
print(outTimeMsg)
|
||||||
log_management(f'{outTimeMsg}\n', logName, logMode) # 记录用时
|
log_management(f'{outTimeMsg}\n', logName, logMode) # 记录用时
|
||||||
|
|
||||||
|
# ------------------压缩文件------------------
|
||||||
|
if (is_compress):
|
||||||
|
webcam_zip(f'{ROOT_PATH}/{zipName}', frame_savePath)
|
||||||
|
|
||||||
|
|
||||||
def main(args):
|
def main(args):
|
||||||
device_index = args.device
|
device_index = args.device
|
||||||
|
@ -193,9 +207,15 @@ def main(args):
|
||||||
png_quality = args.png_quality
|
png_quality = args.png_quality
|
||||||
pause_key = args.pause
|
pause_key = args.pause
|
||||||
auto_frameNum = args.auto_frameNum
|
auto_frameNum = args.auto_frameNum
|
||||||
|
|
||||||
|
# 日志
|
||||||
logName = args.logName
|
logName = args.logName
|
||||||
logMode = args.logMode
|
logMode = args.logMode
|
||||||
|
|
||||||
|
# 压缩
|
||||||
|
is_compress = args.is_compress
|
||||||
|
zipName = args.zipName
|
||||||
|
|
||||||
argsYaml(args) # 脚本参数
|
argsYaml(args) # 脚本参数
|
||||||
|
|
||||||
# 调用webcam opencv
|
# 调用webcam opencv
|
||||||
|
@ -217,7 +237,9 @@ def main(args):
|
||||||
jpg_quality,
|
jpg_quality,
|
||||||
png_quality,
|
png_quality,
|
||||||
logName,
|
logName,
|
||||||
logMode)
|
logMode,
|
||||||
|
is_compress,
|
||||||
|
zipName)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
Loading…
Reference in New Issue