Skip to content

Commit 2ad8e24

Browse files
committed
Update otiotool usage & argument validation
Signed-off-by: Joshua Minor <joshm@pixar.com>
1 parent 639f57c commit 2ad8e24

File tree

1 file changed

+21
-24
lines changed
  • src/py-opentimelineio/opentimelineio/console

1 file changed

+21
-24
lines changed

src/py-opentimelineio/opentimelineio/console/otiotool.py

Lines changed: 21 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -184,35 +184,37 @@ def parse_arguments():
184184
185185
2. Filtering
186186
Options such as --video-only, --audio-only, --only-tracks-with-name,
187-
-only-tracks-with-index, --only-clips-with-name,
187+
--only-tracks-with-index, --only-clips-with-name,
188188
--only-clips-with-name-regex, --remove-transitions, and --trim will remove
189189
content. Only the tracks, clips, etc. that pass all of the filtering options
190190
provided are passed to the next phase.
191191
192192
3. Combine
193-
If specified, the --stack, --concat, and --flatten operations are
193+
If specified, the --stack, or --concat operations are
194194
performed (in that order) to combine all of the input timeline(s) into one.
195195
196-
4. Relink
196+
4. Flatten
197+
If --flatten is specified, then multiple tracks are flattened into one.
198+
199+
5. Relink
197200
The --relink-by-name option, will scan the specified folder(s) looking for
198201
files which match the name of each clip in the input timeline(s).
199202
If matching files are found, clips will be relinked to those files (using
200203
file:// URLs). Clip names are matched to filenames ignoring file extension.
201204
If specified, the --copy-media-to-folder option, will copy or download
202205
all linked media, and relink the OTIO to reference the local copies.
203-
204-
5. Remove/Redact
206+
6. Remove/Redact
205207
The --remove-metadata-key option allows you to remove a specific piece of
206208
metadata from all objects.
207209
If specified, the --redact option, will remove ALL metadata and rename all
208210
objects in the OTIO with generic names (e.g. "Track 1", "Clip 17", etc.)
209211
210-
6. Inspect
212+
7. Inspect
211213
Options such as --stats, --list-clips, --list-tracks, --list-media,
212214
--verify-media, --list-markers, --verify-ranges, and --inspect
213215
will examine the OTIO and print information to standard output.
214216
215-
7. Output
217+
8. Output
216218
Finally, if the "--output <filename>" option is specified, the resulting
217219
OTIO will be written to the specified file. The extension of the output
218220
filename is used to determine the format of the output (e.g. OTIO or any
@@ -248,18 +250,20 @@ def parse_arguments():
248250
)
249251

250252
# Filter...
251-
parser.add_argument(
253+
track_type_group = parser.add_mutually_exclusive_group()
254+
track_type_group.add_argument(
252255
"--video-only",
253256
"-v",
254257
action='store_true',
255258
help="Output only video tracks"
256259
)
257-
parser.add_argument(
260+
track_type_group.add_argument(
258261
"--audio-only",
259262
"-a",
260263
action='store_true',
261264
help="Output only audio tracks"
262265
)
266+
263267
parser.add_argument(
264268
"--only-tracks-with-name",
265269
type=str,
@@ -320,29 +324,32 @@ def parse_arguments():
320324
help="""When used with --flatten, the new flat track is added above the
321325
others instead of replacing them."""
322326
)
323-
parser.add_argument(
327+
328+
combine_group = parser.add_mutually_exclusive_group()
329+
combine_group.add_argument(
324330
"--stack",
325331
"-s",
326332
action='store_true',
327333
help="Stack multiple input files into one timeline"
328334
)
329-
parser.add_argument(
335+
combine_group.add_argument(
330336
"--concat",
331337
"-c",
332338
action='store_true',
333339
help="Concatenate multiple input files end-to-end into one timeline"
334340
)
335341

336342
# Relink
337-
parser.add_argument(
343+
relink_group = parser.add_mutually_exclusive_group()
344+
relink_group.add_argument(
338345
"--relink-by-name",
339346
type=str,
340347
nargs='+',
341348
metavar='FOLDER(s)',
342349
help="""Scan the specified folder looking for filenames which match
343350
each clip's name. If found, clips are relinked to those files."""
344351
)
345-
parser.add_argument(
352+
relink_group.add_argument(
346353
"--copy-media-to-folder",
347354
type=str,
348355
metavar='FOLDER',
@@ -449,20 +456,10 @@ def parse_arguments():
449456
if not any([args.input, args.list_versions]):
450457
parser.error("Must specify at least one of --input or --list-versions.")
451458

452-
# Some options cannot be combined.
453-
454-
if args.video_only and args.audio_only:
455-
parser.error("Cannot use --video-only and --audio-only at the same time.")
456-
457-
if args.stack and args.concat:
458-
parser.error("Cannot use --stack and --concat at the same time.")
459-
459+
# Check some options combination.
460460
if args.keep_flattened_tracks and not args.flatten:
461461
parser.error("Cannot use --keep-flattened-tracks without also using --flatten.")
462462

463-
if args.input and args.list_versions:
464-
parser.error("Cannot combine --input and --list-versions.")
465-
466463
return args
467464

468465

0 commit comments

Comments
 (0)