Coverage for /opt/hostedtoolcache/Python/3.10.17/x64/lib/python3.10/site-packages/vfx_seqtools/actions/seqls.py: 96%
24 statements
« prev ^ index » next coverage.py v7.8.2, created at 2025-05-30 00:30 +0000
« prev ^ index » next coverage.py v7.8.2, created at 2025-05-30 00:30 +0000
1import glob
2import logging
3from typing import Annotated
5import fileseq
6import typer
8from vfx_seqtools import common_options
9from vfx_seqtools.decorators import attach_hook
12@attach_hook(common_options.logging_options, hook_output_kwarg="logger")
13@attach_hook(common_options.version_option, hook_output_kwarg="show_version")
14@attach_hook(common_options.sequence_only_option, hook_output_kwarg="only_on_sequences")
15@attach_hook(common_options.missing_frames_option, hook_output_kwarg="show_missing")
16def seqls(
17 show_version: bool,
18 logger: logging.Logger,
19 filepattern: Annotated[
20 str,
21 typer.Argument(
22 help="An optional file pattern to use, use quotes or escape shell wildcards like '?' and '*'."
23 ),
24 ] = "",
25 only_on_sequences: bool = False,
26 show_missing: bool = False,
27) -> None:
28 """
29 List file sequences.
31 seqls - will list all file sequences in the current directory.
33 seqls file.\*.exr - will list all file sequences matching the pattern 'file.*.exr' (escaping shell wildcards).
35 seqls "file.????.exr" - will list all file sequences matching the pattern 'file.????.exr' (quoting shell wildcards).
37 """
38 if filepattern:
39 files = glob.glob(filepattern)
40 seqs = fileseq.findSequencesInList(files)
41 else:
42 seqs = fileseq.findSequencesOnDisk(".")
44 for seq in seqs:
45 if only_on_sequences and "@" not in str(seq) and "#" not in str(seq):
46 continue
47 print(f"{seq}")
48 if show_missing:
49 missing_frames = seq.invertedFrameRange()
50 if missing_frames:
51 print(f"Missing frames: {missing_frames}")