Skip to content

Commit 55918a0

Browse files
authored
Merge pull request #208 from ReproNim/enh-video-audit-tune
Concurrency execution support and tunnings in `video-audit` command
2 parents fad26a1 + 32970a2 commit 55918a0

File tree

3 files changed

+207
-44
lines changed

3 files changed

+207
-44
lines changed

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ dependencies = [
4141
"pyzbar>=0.1.9",
4242
"qrcode>=8.0",
4343
"opencv-python>=4.9.0.80",
44+
"filelock>=3.16.0",
4445
]
4546

4647
[project.optional-dependencies]

src/reprostim/cli/cmd_video_audit.py

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,21 @@
1919
"recording and produces a summary table "
2020
"(videos.tsv) ."
2121
)
22-
@click.argument("path", type=click.Path(exists=True))
22+
@click.argument(
23+
"paths",
24+
nargs=-1, # accept 1 or more arguments
25+
type=click.Path(exists=True, dir_okay=True, file_okay=True),
26+
)
2327
@click.option(
2428
"-m",
2529
"--mode",
2630
type=click.Choice(["full", "incremental", "force",
2731
"rerun-for-na", "reset-to-na"],
2832
case_sensitive=True),
2933
default="incremental",
34+
show_default=True,
3035
help=(
31-
"""Specifies operation mode, default is 'incremental' :.
36+
"""Specifies operation mode:.
3237
3338
- [full] : regenerate everything from scratch,
3439
@@ -109,7 +114,8 @@
109114
)
110115
@click.pass_context
111116
def video_audit(
112-
ctx, path: str, mode: str, output: str,
117+
ctx, paths: tuple[str, ...],
118+
mode: str, output: str,
113119
recursive: bool, audit_src,
114120
max_files: int, path_mask: str,
115121
verbose: bool
@@ -120,7 +126,7 @@ def video_audit(
120126

121127
logger.debug("video_audit(...)")
122128
logger.debug(f"Working dir : {os.getcwd()}")
123-
logger.info(f"Video full path : {path}")
129+
logger.info(f"Video full paths : {paths}")
124130
logger.info(f"Output TSV file : {output}")
125131
logger.info(f"Recursive scan : {recursive}")
126132
logger.info(f"Operation mode : {mode}")
@@ -130,11 +136,12 @@ def video_audit(
130136
logger.info(f"Path mask : {path_mask}")
131137
logger.info(f"Verbose output : {verbose}")
132138

133-
if not os.path.exists(path):
134-
logger.error(f"Path does not exist: {path}")
135-
return 1
139+
for path in paths:
140+
if not os.path.exists(path):
141+
logger.error(f"Path does not exist: {path}")
142+
return 1
136143

137-
do_main(path, output, recursive, VaMode(mode),
144+
do_main(list(paths), output, recursive, VaMode(mode),
138145
{VaSource(s) for s in audit_src},
139146
max_files, path_mask, verbose, click.echo)
140147
return 0

0 commit comments

Comments
 (0)