41
41
# XXX: python2.7 only
42
42
from backports import tempfile
43
43
44
-
45
44
SAMPLE_DATA_DIR = os .path .join (os .path .dirname (__file__ ), "sample_data" )
46
45
SCREENING_EXAMPLE_PATH = os .path .join (SAMPLE_DATA_DIR , "screening_example.edl" )
46
+ AVID_EXAMPLE_PATH = os .path .join (SAMPLE_DATA_DIR , "avid_example.edl" )
47
47
NUCODA_EXAMPLE_PATH = os .path .join (SAMPLE_DATA_DIR , "nucoda_example.edl" )
48
+ PREMIERE_EXAMPLE_PATH = os .path .join (SAMPLE_DATA_DIR , "premiere_example.edl" )
48
49
EXEMPLE_25_FPS_PATH = os .path .join (SAMPLE_DATA_DIR , "25fps.edl" )
49
50
NO_SPACES_PATH = os .path .join (SAMPLE_DATA_DIR , "no_spaces_test.edl" )
50
51
DISSOLVE_TEST = os .path .join (SAMPLE_DATA_DIR , "dissolve_test.edl" )
55
56
WIPE_TEST = os .path .join (SAMPLE_DATA_DIR , "wipe_test.edl" )
56
57
TIMECODE_MISMATCH_TEST = os .path .join (SAMPLE_DATA_DIR , "timecode_mismatch.edl" )
57
58
SPEED_EFFECTS_TEST = os .path .join (SAMPLE_DATA_DIR , "speed_effects.edl" )
58
- SPEED_EFFECTS_TEST_SMALL = os .path .join (
59
- SAMPLE_DATA_DIR ,
60
- "speed_effects_small.edl"
61
- )
59
+ SPEED_EFFECTS_TEST_SMALL = os .path .join (SAMPLE_DATA_DIR , "speed_effects_small.edl" )
62
60
MULTIPLE_TARGET_AUDIO_PATH = os .path .join (SAMPLE_DATA_DIR , "multi_audio.edl" )
63
61
TRANSITION_DURATION_TEST = os .path .join (SAMPLE_DATA_DIR , "transition_duration.edl" )
64
62
@@ -674,47 +672,81 @@ def test_read_generators(self):
674
672
'SMPTEBars'
675
673
)
676
674
677
- def test_nucoda_edl_read (self ):
678
- edl_path = NUCODA_EXAMPLE_PATH
679
- fps = 24
680
- timeline = otio .adapters .read_from_file (edl_path )
681
- self .assertTrue (timeline is not None )
682
- self .assertEqual (len (timeline .tracks ), 1 )
683
- self .assertEqual (len (timeline .tracks [0 ]), 2 )
684
- self .assertEqual (
685
- timeline .tracks [0 ][0 ].name ,
686
- "take_1"
687
- )
688
- self .assertEqual (
689
- timeline .tracks [0 ][0 ].source_range .duration ,
690
- otio .opentime .from_timecode ("00:00:01:07" , fps )
691
- )
692
- self .assertIsOTIOEquivalentTo (
693
- timeline .tracks [0 ][0 ].media_reference ,
694
- otio .schema .ExternalReference (
695
- target_url = r"S:\path\to\ZZ100_501.take_1.0001.exr"
675
+ def test_style_edl_read (self ):
676
+ edl_paths = [AVID_EXAMPLE_PATH , NUCODA_EXAMPLE_PATH , PREMIERE_EXAMPLE_PATH ]
677
+ for edl_path in edl_paths :
678
+ fps = 24
679
+ timeline = otio .adapters .read_from_file (edl_path )
680
+ self .assertTrue (timeline is not None )
681
+ self .assertEqual (len (timeline .tracks ), 1 )
682
+ self .assertEqual (len (timeline .tracks [0 ]), 2 )
683
+ print (edl_path )
684
+
685
+ # If cannot assertEqual fails with clip name
686
+ # Attempt to assertEqual with
687
+ try :
688
+ self .assertEqual (
689
+ timeline .tracks [0 ][0 ].name ,
690
+ "take_1"
691
+ )
692
+ except AssertionError :
693
+ self .assertEqual (
694
+ timeline .tracks [0 ][0 ].name ,
695
+ "ZZ100_501.take_1.0001.exr"
696
+ )
697
+ self .assertEqual (
698
+ timeline .tracks [0 ][0 ].source_range .duration ,
699
+ otio .opentime .from_timecode ("00:00:01:07" , fps )
696
700
)
697
- )
698
- self .assertEqual (
699
- timeline .tracks [0 ][1 ].name ,
700
- "take_2"
701
- )
702
- self .assertEqual (
703
- timeline .tracks [0 ][1 ].source_range .duration ,
704
- otio .opentime .from_timecode ("00:00:02:02" , fps )
705
- )
706
- self .assertIsOTIOEquivalentTo (
707
- timeline .tracks [0 ][1 ].media_reference ,
708
- otio .schema .ExternalReference (
709
- target_url = r"S:\path\to\ZZ100_502A.take_2.0101.exr"
701
+ print (timeline .tracks [0 ][0 ].media_reference )
702
+
703
+ try :
704
+ self .assertIsOTIOEquivalentTo (
705
+ timeline .tracks [0 ][0 ].media_reference ,
706
+ otio .schema .ExternalReference (
707
+ target_url = r"S:\path\to\ZZ100_501.take_1.0001.exr"
708
+ )
709
+ )
710
+ except AssertionError :
711
+ self .assertIsOTIOEquivalentTo (
712
+ timeline .tracks [0 ][0 ].media_reference ,
713
+ otio .schema .MissingReference ()
714
+ )
715
+
716
+ try :
717
+ self .assertEqual (
718
+ timeline .tracks [0 ][1 ].name ,
719
+ "take_2"
720
+ )
721
+ except AssertionError :
722
+ self .assertEqual (
723
+ timeline .tracks [0 ][1 ].name ,
724
+ "ZZ100_502A.take_2.0101.exr"
725
+ )
726
+
727
+ self .assertEqual (
728
+ timeline .tracks [0 ][1 ].source_range .duration ,
729
+ otio .opentime .from_timecode ("00:00:02:02" , fps )
710
730
)
711
- )
712
731
713
- def test_nucoda_edl_write (self ):
732
+ try :
733
+ self .assertIsOTIOEquivalentTo (
734
+ timeline .tracks [0 ][1 ].media_reference ,
735
+ otio .schema .ExternalReference (
736
+ target_url = r"S:\path\to\ZZ100_502A.take_2.0101.exr"
737
+ )
738
+ )
739
+ except AssertionError :
740
+ self .assertIsOTIOEquivalentTo (
741
+ timeline .tracks [0 ][1 ].media_reference ,
742
+ otio .schema .MissingReference ()
743
+ )
744
+
745
+ def test_style_edl_write (self ):
714
746
track = otio .schema .Track ()
715
- tl = otio .schema .Timeline ("test_nucoda_timeline " , tracks = [track ])
747
+ tl = otio .schema .Timeline ("temp " , tracks = [track ])
716
748
rt = otio .opentime .RationalTime (5.0 , 24.0 )
717
- mr = otio .schema .ExternalReference (target_url = r"S:\ var\ tmp\ test.exr" )
749
+ mr = otio .schema .ExternalReference (target_url = r"S:/ var/ tmp/ test.exr" )
718
750
719
751
tr = otio .opentime .TimeRange (
720
752
start_time = otio .opentime .RationalTime (0.0 , 24.0 ),
@@ -741,6 +773,7 @@ def test_nucoda_edl_write(self):
741
773
tl .tracks [0 ].append (gap )
742
774
tl .tracks [0 ].append (cl2 )
743
775
776
+ tl .name = 'test_nucoda_timeline'
744
777
result = otio .adapters .write_to_string (
745
778
tl ,
746
779
adapter_name = 'cmx_3600' ,
@@ -751,11 +784,53 @@ def test_nucoda_edl_write(self):
751
784
752
785
001 test V C 00:00:00:00 00:00:00:05 00:00:00:00 00:00:00:05
753
786
* FROM CLIP NAME: test clip1
754
- * FROM FILE: S:\var\tmp\test.exr
787
+ * FROM FILE: S:/var/tmp/test.exr
788
+ * OTIO TRUNCATED REEL NAME FROM: test.exr
789
+ 002 test V C 00:00:00:00 00:00:00:05 00:00:01:05 00:00:01:10
790
+ * FROM CLIP NAME: test clip2
791
+ * FROM FILE: S:/var/tmp/test.exr
792
+ * OTIO TRUNCATED REEL NAME FROM: test.exr
793
+ '''
794
+
795
+ self .assertMultiLineEqual (result , expected )
796
+
797
+ tl .name = 'test_avid_timeline'
798
+ result = otio .adapters .write_to_string (
799
+ tl ,
800
+ adapter_name = 'cmx_3600' ,
801
+ style = 'avid'
802
+ )
803
+
804
+ expected = r'''TITLE: test_avid_timeline
805
+
806
+ 001 test V C 00:00:00:00 00:00:00:05 00:00:00:00 00:00:00:05
807
+ * FROM CLIP NAME: test clip1
808
+ * FROM CLIP: S:/var/tmp/test.exr
755
809
* OTIO TRUNCATED REEL NAME FROM: test.exr
756
810
002 test V C 00:00:00:00 00:00:00:05 00:00:01:05 00:00:01:10
757
811
* FROM CLIP NAME: test clip2
758
- * FROM FILE: S:\var\tmp\test.exr
812
+ * FROM CLIP: S:/var/tmp/test.exr
813
+ * OTIO TRUNCATED REEL NAME FROM: test.exr
814
+ '''
815
+
816
+ self .assertMultiLineEqual (result , expected )
817
+
818
+ tl .name = 'test_premiere_timeline'
819
+ result = otio .adapters .write_to_string (
820
+ tl ,
821
+ adapter_name = 'cmx_3600' ,
822
+ style = 'premiere'
823
+ )
824
+
825
+ expected = r'''TITLE: test_premiere_timeline
826
+
827
+ 001 AX V C 00:00:00:00 00:00:00:05 00:00:00:00 00:00:00:05
828
+ * FROM CLIP NAME: test.exr
829
+ * OTIO REFERENCE FROM: S:/var/tmp/test.exr
830
+ * OTIO TRUNCATED REEL NAME FROM: test.exr
831
+ 002 AX V C 00:00:00:00 00:00:00:05 00:00:01:05 00:00:01:10
832
+ * FROM CLIP NAME: test.exr
833
+ * OTIO REFERENCE FROM: S:/var/tmp/test.exr
759
834
* OTIO TRUNCATED REEL NAME FROM: test.exr
760
835
'''
761
836
@@ -767,10 +842,10 @@ def test_reels_edl_round_trip_string2mem2string(self):
767
842
768
843
001 ZZ100_50 V C 01:00:04:05 01:00:05:12 00:59:53:11 00:59:54:18
769
844
* FROM CLIP NAME: take_1
770
- * FROM FILE: S:\ path\to\ ZZ100_501.take_1.0001.exr
845
+ * FROM FILE: S:/ path/to/ ZZ100_501.take_1.0001.exr
771
846
002 ZZ100_50 V C 01:00:06:13 01:00:08:15 00:59:54:18 00:59:56:20
772
847
* FROM CLIP NAME: take_2
773
- * FROM FILE: S:\ path\to\ ZZ100_502A.take_2.0101.exr
848
+ * FROM FILE: S:/ path/to/ ZZ100_502A.take_2.0101.exr
774
849
'''
775
850
776
851
timeline = otio .adapters .read_from_string (sample_data , adapter_name = "cmx_3600" )
0 commit comments