@@ -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+
2302366. 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():
251257otiotool -i playlist.otio --verify-media
252258
253259Inspect 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
516523def diff_otio (tlA , tlB ):
517- return getDiff .main (tlA , tlB )
524+ return getDiff .diff (tlA , tlB )
518525
519526# ===================
520527
0 commit comments