@@ -137,7 +137,8 @@ def main():
137
137
args .list_media or
138
138
args .verify_media or
139
139
args .list_tracks or
140
- args .list_markers )
140
+ args .list_markers or
141
+ args .verify_ranges )
141
142
if should_summarize :
142
143
for timeline in timelines :
143
144
summarize_timeline (
@@ -146,6 +147,7 @@ def main():
146
147
args .list_media ,
147
148
args .verify_media ,
148
149
args .list_markers ,
150
+ args .verify_ranges ,
149
151
timeline )
150
152
151
153
# Final Phase: Output
@@ -207,8 +209,8 @@ def parse_arguments():
207
209
208
210
6. Inspect
209
211
Options such as --stats, --list-clips, --list-tracks, --list-media,
210
- --verify-media, --list-markers, and --inspect will examine the OTIO and
211
- print information to standard output.
212
+ --verify-media, --list-markers, --verify-ranges, and --inspect
213
+ will examine the OTIO and print information to standard output.
212
214
213
215
7. Output
214
216
Finally, if the "--output <filename>" option is specified, the resulting
@@ -397,6 +399,13 @@ def parse_arguments():
397
399
action = 'store_true' ,
398
400
help = "List summary of all markers"
399
401
)
402
+ parser .add_argument (
403
+ "--verify-ranges" ,
404
+ action = 'store_true' ,
405
+ help = """Verify that each clip in a timeline has a source range
406
+ within the available range of media
407
+ (acceptable in some use cases, not in others)"""
408
+ )
400
409
parser .add_argument (
401
410
"--inspect" ,
402
411
type = str ,
@@ -852,7 +861,7 @@ def inspect_timelines(name_regex, timeline):
852
861
853
862
854
863
def summarize_timeline (list_tracks , list_clips , list_media , verify_media ,
855
- list_markers , timeline ):
864
+ list_markers , verify_ranges , timeline ):
856
865
"""Print a summary of a timeline, optionally listing the tracks, clips, media,
857
866
and/or markers inside it."""
858
867
print ("TIMELINE:" , timeline .name )
@@ -861,8 +870,30 @@ def summarize_timeline(list_tracks, list_clips, list_media, verify_media,
861
870
if list_tracks :
862
871
print (f"TRACK: { child .name } ({ child .kind } )" )
863
872
if isinstance (child , otio .schema .Clip ):
864
- if list_clips :
865
- print (" CLIP:" , child .name )
873
+ if list_clips or verify_ranges :
874
+ if verify_ranges :
875
+ range_msg = ""
876
+ try :
877
+ source = child .source_range
878
+ available = child .available_range ()
879
+
880
+ # contains() uses end_time_exclusive(),
881
+ # does not handle case when
882
+ # the end of the source range
883
+ # meets available range exactly
884
+ available_start = available .start_time
885
+ available_end = available .end_time_inclusive ()
886
+ src_start = source .start_time
887
+ src_end = source .end_time_inclusive ()
888
+ if src_start < available_start or available_end < src_end :
889
+ range_msg = "SOURCE MEDIA OUT OF BOUNDS"
890
+ else :
891
+ range_msg = "IN BOUNDS"
892
+ except Exception : # available range is, well, unavailable
893
+ pass
894
+ print (" CLIP:" , child .name , range_msg )
895
+ else :
896
+ print (" CLIP:" , child .name )
866
897
if list_media or verify_media :
867
898
try :
868
899
url = child .media_reference .target_url
0 commit comments