Skip to content

Commit 511754c

Browse files
committed
added otiodiff description and example to otiotool description, fixed typo in inspect example, and updated otiodiff function call from main to diff
1 parent a9c6fa8 commit 511754c

File tree

1 file changed

+19
-12
lines changed
  • src/py-opentimelineio/opentimelineio/console

1 file changed

+19
-12
lines changed

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

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -116,21 +116,22 @@ def main():
116116
for timeline in timelines:
117117
copy_media_to_folder(timeline, args.copy_media_to_folder)
118118

119-
# TODO: Update help text and numbering
119+
# TODO: Update numbering
120120
# ===== NEW Phase 5.5: Diff otio files ======
121121

122122
if args.diff:
123-
# TODO: check there's exactly 2 timelines, complain if not
124-
# error if less than 2, if more than 2
125123
# TODO? stack, concat, diff make mutually exclusive
126124

127125
# print("comparing:", timelines[0].name, timelines[1].name)
126+
assert len(timelines) >= 2, "Less than 2 timelines given. 2 timelines are required to perform a diff"
128127

129-
# function that serves as wrapper to call actual getDiff main
130-
timelines = [diff_otio(timelines[0], timelines[1])]
131-
132-
# TODO: warning? if timeline empty (no output)
133-
# TODO: test for empty timeline inputs
128+
# TODO: test for empty timeline inputs, currently checks for existence of timeline but not of tracks in timeline
129+
if len(timelines) == 2:
130+
timelines = [diff_otio(timelines[0], timelines[1])]
131+
if len(timelines) == 0:
132+
print("no output timeline generated by diff")
133+
else:
134+
print("Warning: more than 2 timelines provided as input. Only the first two timelines will be diffed.")
134135

135136
# Phase 6: Remove/Redaction
136137

@@ -227,6 +228,11 @@ def parse_arguments():
227228
If specified, the --redact option, will remove ALL metadata and rename all
228229
objects in the OTIO with generic names (e.g. "Track 1", "Clip 17", etc.)
229230
231+
5.5 Diff
232+
The --diff option allows you to compare two OTIO files. It generates an
233+
OTIO file annotated with the differences as well as a in console text
234+
summary report. --diff can't be used concurrently with --stack or --concat
235+
230236
6. Inspect
231237
Options such as --stats, --list-clips, --list-tracks, --list-media,
232238
--verify-media, --list-markers, --verify-ranges, and --inspect
@@ -251,13 +257,14 @@ def parse_arguments():
251257
otiotool -i playlist.otio --verify-media
252258
253259
Inspect specific audio clips in detail:
254-
otiotool -i playlist.otio --only-audio --list-tracks --inspect "Interview"
260+
otiotool -i playlist.otio --audio-only --list-tracks --inspect "Interview"
261+
262+
Diff fileB against fileA (ordering matters where fileA is the file fileB compares against):
263+
otiotool -i fileA.otio fileB.otio --diff --o display.otio
255264
""",
256265
formatter_class=argparse.RawDescriptionHelpFormatter
257266
)
258267

259-
# TODO: add ex for otiodiff above^
260-
261268
# Input...
262269
parser.add_argument(
263270
"--input",
@@ -514,7 +521,7 @@ def read_inputs(input_paths):
514521
# ======= NEW =======
515522

516523
def diff_otio(tlA, tlB):
517-
return getDiff.main(tlA, tlB)
524+
return getDiff.diff(tlA, tlB)
518525

519526
# ===================
520527

0 commit comments

Comments
 (0)