16
16
from tempfile import TemporaryDirectory # noqa: F401
17
17
import tempfile
18
18
19
-
20
19
SAMPLE_DATA_DIR = os .path .join (os .path .dirname (__file__ ), "sample_data" )
21
20
SCREENING_EXAMPLE_PATH = os .path .join (SAMPLE_DATA_DIR , "screening_example.edl" )
21
+ AVID_EXAMPLE_PATH = os .path .join (SAMPLE_DATA_DIR , "avid_example.edl" )
22
22
NUCODA_EXAMPLE_PATH = os .path .join (SAMPLE_DATA_DIR , "nucoda_example.edl" )
23
+ PREMIERE_EXAMPLE_PATH = os .path .join (SAMPLE_DATA_DIR , "premiere_example.edl" )
23
24
EXEMPLE_25_FPS_PATH = os .path .join (SAMPLE_DATA_DIR , "25fps.edl" )
24
25
NO_SPACES_PATH = os .path .join (SAMPLE_DATA_DIR , "no_spaces_test.edl" )
25
26
DISSOLVE_TEST = os .path .join (SAMPLE_DATA_DIR , "dissolve_test.edl" )
30
31
WIPE_TEST = os .path .join (SAMPLE_DATA_DIR , "wipe_test.edl" )
31
32
TIMECODE_MISMATCH_TEST = os .path .join (SAMPLE_DATA_DIR , "timecode_mismatch.edl" )
32
33
SPEED_EFFECTS_TEST = os .path .join (SAMPLE_DATA_DIR , "speed_effects.edl" )
33
- SPEED_EFFECTS_TEST_SMALL = os .path .join (
34
- SAMPLE_DATA_DIR ,
35
- "speed_effects_small.edl"
36
- )
34
+ SPEED_EFFECTS_TEST_SMALL = os .path .join (SAMPLE_DATA_DIR , "speed_effects_small.edl" )
37
35
MULTIPLE_TARGET_AUDIO_PATH = os .path .join (SAMPLE_DATA_DIR , "multi_audio.edl" )
38
36
TRANSITION_DURATION_TEST = os .path .join (SAMPLE_DATA_DIR , "transition_duration.edl" )
39
37
ENABLED_TEST = os .path .join (SAMPLE_DATA_DIR , "enabled.otio" )
@@ -714,47 +712,81 @@ def test_read_generators(self):
714
712
'SMPTEBars'
715
713
)
716
714
717
- def test_nucoda_edl_read (self ):
718
- edl_path = NUCODA_EXAMPLE_PATH
719
- fps = 24
720
- timeline = otio .adapters .read_from_file (edl_path )
721
- self .assertTrue (timeline is not None )
722
- self .assertEqual (len (timeline .tracks ), 1 )
723
- self .assertEqual (len (timeline .tracks [0 ]), 2 )
724
- self .assertEqual (
725
- timeline .tracks [0 ][0 ].name ,
726
- "take_1"
727
- )
728
- self .assertEqual (
729
- timeline .tracks [0 ][0 ].source_range .duration ,
730
- otio .opentime .from_timecode ("00:00:01:07" , fps )
731
- )
732
- self .assertIsOTIOEquivalentTo (
733
- timeline .tracks [0 ][0 ].media_reference ,
734
- otio .schema .ExternalReference (
735
- target_url = r"S:\path\to\ZZ100_501.take_1.0001.exr"
715
+ def test_style_edl_read (self ):
716
+ edl_paths = [AVID_EXAMPLE_PATH , NUCODA_EXAMPLE_PATH , PREMIERE_EXAMPLE_PATH ]
717
+ for edl_path in edl_paths :
718
+ fps = 24
719
+ timeline = otio .adapters .read_from_file (edl_path )
720
+ self .assertTrue (timeline is not None )
721
+ self .assertEqual (len (timeline .tracks ), 1 )
722
+ self .assertEqual (len (timeline .tracks [0 ]), 2 )
723
+ print (edl_path )
724
+
725
+ # If cannot assertEqual fails with clip name
726
+ # Attempt to assertEqual with
727
+ try :
728
+ self .assertEqual (
729
+ timeline .tracks [0 ][0 ].name ,
730
+ "take_1"
731
+ )
732
+ except AssertionError :
733
+ self .assertEqual (
734
+ timeline .tracks [0 ][0 ].name ,
735
+ "ZZ100_501.take_1.0001.exr"
736
+ )
737
+ self .assertEqual (
738
+ timeline .tracks [0 ][0 ].source_range .duration ,
739
+ otio .opentime .from_timecode ("00:00:01:07" , fps )
736
740
)
737
- )
738
- self .assertEqual (
739
- timeline .tracks [0 ][1 ].name ,
740
- "take_2"
741
- )
742
- self .assertEqual (
743
- timeline .tracks [0 ][1 ].source_range .duration ,
744
- otio .opentime .from_timecode ("00:00:02:02" , fps )
745
- )
746
- self .assertIsOTIOEquivalentTo (
747
- timeline .tracks [0 ][1 ].media_reference ,
748
- otio .schema .ExternalReference (
749
- target_url = r"S:\path\to\ZZ100_502A.take_2.0101.exr"
741
+ print (timeline .tracks [0 ][0 ].media_reference )
742
+
743
+ try :
744
+ self .assertIsOTIOEquivalentTo (
745
+ timeline .tracks [0 ][0 ].media_reference ,
746
+ otio .schema .ExternalReference (
747
+ target_url = r"S:\path\to\ZZ100_501.take_1.0001.exr"
748
+ )
749
+ )
750
+ except AssertionError :
751
+ self .assertIsOTIOEquivalentTo (
752
+ timeline .tracks [0 ][0 ].media_reference ,
753
+ otio .schema .MissingReference ()
754
+ )
755
+
756
+ try :
757
+ self .assertEqual (
758
+ timeline .tracks [0 ][1 ].name ,
759
+ "take_2"
760
+ )
761
+ except AssertionError :
762
+ self .assertEqual (
763
+ timeline .tracks [0 ][1 ].name ,
764
+ "ZZ100_502A.take_2.0101.exr"
765
+ )
766
+
767
+ self .assertEqual (
768
+ timeline .tracks [0 ][1 ].source_range .duration ,
769
+ otio .opentime .from_timecode ("00:00:02:02" , fps )
750
770
)
751
- )
752
771
753
- def test_nucoda_edl_write (self ):
772
+ try :
773
+ self .assertIsOTIOEquivalentTo (
774
+ timeline .tracks [0 ][1 ].media_reference ,
775
+ otio .schema .ExternalReference (
776
+ target_url = r"S:\path\to\ZZ100_502A.take_2.0101.exr"
777
+ )
778
+ )
779
+ except AssertionError :
780
+ self .assertIsOTIOEquivalentTo (
781
+ timeline .tracks [0 ][1 ].media_reference ,
782
+ otio .schema .MissingReference ()
783
+ )
784
+
785
+ def test_style_edl_write (self ):
754
786
track = otio .schema .Track ()
755
- tl = otio .schema .Timeline ("test_nucoda_timeline " , tracks = [track ])
787
+ tl = otio .schema .Timeline ("temp " , tracks = [track ])
756
788
rt = otio .opentime .RationalTime (5.0 , 24.0 )
757
- mr = otio .schema .ExternalReference (target_url = r"S:\ var\ tmp\ test.exr" )
789
+ mr = otio .schema .ExternalReference (target_url = r"S:/ var/ tmp/ test.exr" )
758
790
759
791
tr = otio .opentime .TimeRange (
760
792
start_time = otio .opentime .RationalTime (0.0 , 24.0 ),
@@ -781,6 +813,7 @@ def test_nucoda_edl_write(self):
781
813
tl .tracks [0 ].append (gap )
782
814
tl .tracks [0 ].append (cl2 )
783
815
816
+ tl .name = 'test_nucoda_timeline'
784
817
result = otio .adapters .write_to_string (
785
818
tl ,
786
819
adapter_name = 'cmx_3600' ,
@@ -791,11 +824,53 @@ def test_nucoda_edl_write(self):
791
824
792
825
001 test V C 00:00:00:00 00:00:00:05 00:00:00:00 00:00:00:05
793
826
* FROM CLIP NAME: test clip1
794
- * FROM FILE: S:\var\tmp\test.exr
827
+ * FROM FILE: S:/var/tmp/test.exr
828
+ * OTIO TRUNCATED REEL NAME FROM: test.exr
829
+ 002 test V C 00:00:00:00 00:00:00:05 00:00:01:05 00:00:01:10
830
+ * FROM CLIP NAME: test clip2
831
+ * FROM FILE: S:/var/tmp/test.exr
832
+ * OTIO TRUNCATED REEL NAME FROM: test.exr
833
+ '''
834
+
835
+ self .assertMultiLineEqual (result , expected )
836
+
837
+ tl .name = 'test_avid_timeline'
838
+ result = otio .adapters .write_to_string (
839
+ tl ,
840
+ adapter_name = 'cmx_3600' ,
841
+ style = 'avid'
842
+ )
843
+
844
+ expected = r'''TITLE: test_avid_timeline
845
+
846
+ 001 test V C 00:00:00:00 00:00:00:05 00:00:00:00 00:00:00:05
847
+ * FROM CLIP NAME: test clip1
848
+ * FROM CLIP: S:/var/tmp/test.exr
795
849
* OTIO TRUNCATED REEL NAME FROM: test.exr
796
850
002 test V C 00:00:00:00 00:00:00:05 00:00:01:05 00:00:01:10
797
851
* FROM CLIP NAME: test clip2
798
- * FROM FILE: S:\var\tmp\test.exr
852
+ * FROM CLIP: S:/var/tmp/test.exr
853
+ * OTIO TRUNCATED REEL NAME FROM: test.exr
854
+ '''
855
+
856
+ self .assertMultiLineEqual (result , expected )
857
+
858
+ tl .name = 'test_premiere_timeline'
859
+ result = otio .adapters .write_to_string (
860
+ tl ,
861
+ adapter_name = 'cmx_3600' ,
862
+ style = 'premiere'
863
+ )
864
+
865
+ expected = r'''TITLE: test_premiere_timeline
866
+
867
+ 001 AX V C 00:00:00:00 00:00:00:05 00:00:00:00 00:00:00:05
868
+ * FROM CLIP NAME: test.exr
869
+ * OTIO REFERENCE FROM: S:/var/tmp/test.exr
870
+ * OTIO TRUNCATED REEL NAME FROM: test.exr
871
+ 002 AX V C 00:00:00:00 00:00:00:05 00:00:01:05 00:00:01:10
872
+ * FROM CLIP NAME: test.exr
873
+ * OTIO REFERENCE FROM: S:/var/tmp/test.exr
799
874
* OTIO TRUNCATED REEL NAME FROM: test.exr
800
875
'''
801
876
@@ -807,10 +882,10 @@ def test_reels_edl_round_trip_string2mem2string(self):
807
882
808
883
001 ZZ100_50 V C 01:00:04:05 01:00:05:12 00:59:53:11 00:59:54:18
809
884
* FROM CLIP NAME: take_1
810
- * FROM FILE: S:\ path\to\ ZZ100_501.take_1.0001.exr
885
+ * FROM FILE: S:/ path/to/ ZZ100_501.take_1.0001.exr
811
886
002 ZZ100_50 V C 01:00:06:13 01:00:08:15 00:59:54:18 00:59:56:20
812
887
* FROM CLIP NAME: take_2
813
- * FROM FILE: S:\ path\to\ ZZ100_502A.take_2.0101.exr
888
+ * FROM FILE: S:/ path/to/ ZZ100_502A.take_2.0101.exr
814
889
'''
815
890
816
891
timeline = otio .adapters .read_from_string (sample_data , adapter_name = "cmx_3600" )
0 commit comments