コード例 #1
0
    def test_to_xml_method_is_working_properly(self):
        """testing if the to xml method is working properly
        """
        s = Sequence()
        s.duration = 109
        s.name = 'previs_edit_v001'

        s.rate = Rate(timebase='24', ntsc=False)

        s.timecode = '00:00:00:00'

        m = Media()
        s.media = m

        v = Video()
        v.width = 1024
        v.height = 778
        m.video = v

        t = Track()
        t.enabled = True
        t.locked = False

        v.tracks.append(t)

        # clip 1
        f = File()
        f.duration = 34
        f.name = 'shot2'
        f.pathurl = 'file:///home/eoyilmaz/maya/projects/default/data/shot2.mov'

        c = Clip()
        c.id = 'shot2'
        c.start = 1
        c.end = 35
        c.name = 'shot2'
        c.enabled = True
        c.duration = 34
        c.in_ = 0
        c.out = 34
        c.file = f

        t.clips.append(c)

        # clip 2
        f = File()
        f.duration = 30
        f.name = 'shot'
        f.pathurl = 'file:///home/eoyilmaz/maya/projects/default/data/shot.mov'

        c = Clip()
        c.id = 'shot'
        c.start = 35
        c.end = 65
        c.name = 'shot'
        c.enabled = True
        c.duration = 30
        c.in_ = 0
        c.out = 30
        c.file = f

        t.clips.append(c)

        # clip 3
        f = File()
        f.duration = 45
        f.name = 'shot1'
        f.pathurl = 'file:///home/eoyilmaz/maya/projects/default/data/shot1.mov'

        c = Clip()
        c.id = 'shot1'
        c.start = 65
        c.end = 110
        c.name = 'shot1'
        c.enabled = True
        c.duration = 45
        c.in_ = 0
        c.out = 45
        c.file = f

        t.clips.append(c)

        expected_xml = \
            """<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xmeml>
<xmeml version="5">
<sequence>
  <duration>109</duration>
  <name>previs_edit_v001</name>
  <rate>
    <timebase>24</timebase>
    <ntsc>FALSE</ntsc>
  </rate>
  <timecode>
    <string>00:00:00:00</string>
  </timecode>
  <media>
    <video>
      <format>
        <samplecharacteristics>
          <width>1024</width>
          <height>778</height>
        </samplecharacteristics>
      </format>
      <track>
        <locked>FALSE</locked>
        <enabled>TRUE</enabled>
        <clipitem id="shot2">
          <end>35</end>
          <name>shot2</name>
          <enabled>True</enabled>
          <start>1</start>
          <in>0</in>
          <duration>34</duration>
          <out>34</out>
          <file id="shot2.mov">
            <duration>34</duration>
            <name>shot2</name>
            <pathurl>file://localhost/home/eoyilmaz/maya/projects/default/data/shot2.mov</pathurl>
          </file>
        </clipitem>
        <clipitem id="shot">
          <end>65</end>
          <name>shot</name>
          <enabled>True</enabled>
          <start>35</start>
          <in>0</in>
          <duration>30</duration>
          <out>30</out>
          <file id="shot.mov">
            <duration>30</duration>
            <name>shot</name>
            <pathurl>file://localhost/home/eoyilmaz/maya/projects/default/data/shot.mov</pathurl>
          </file>
        </clipitem>
        <clipitem id="shot1">
          <end>110</end>
          <name>shot1</name>
          <enabled>True</enabled>
          <start>65</start>
          <in>0</in>
          <duration>45</duration>
          <out>45</out>
          <file id="shot1.mov">
            <duration>45</duration>
            <name>shot1</name>
            <pathurl>file://localhost/home/eoyilmaz/maya/projects/default/data/shot1.mov</pathurl>
          </file>
        </clipitem>
      </track>
    </video>
  </media>
</sequence>
</xmeml>"""

        self.assertEqual(
            expected_xml,
            s.to_xml()
        )
コード例 #2
0
    def test_to_metafuze_xml_is_working_properly(self):
        """testing if to_metafuze_xml method is working properly
        """
        s = Sequence()
        s.duration = 109
        s.name = 'SEQ001_HSNI_003'
        s.timecode = '00:00:00:00'

        r = Rate()
        s.rate = r
        r.ntsc = False
        r.timebase = '24'

        m = Media()
        s.media = m

        v = Video()
        v.width = 1024
        v.height = 778
        m.video = v

        t = Track()
        t.enabled = True
        t.locked = False

        v.tracks.append(t)

        # clip 1
        f = File()
        f.duration = 34
        f.name = 'SEQ001_HSNI_003_0010_v001'
        f.pathurl = 'file://localhost/tmp/SEQ001_HSNI_003_0010_v001.mov'

        c = Clip()
        c.id = '0010'
        c.start = 1
        c.end = 35
        c.name = 'SEQ001_HSNI_003_0010_v001'
        c.enabled = True
        c.duration = 34
        c.in_ = 0
        c.out = 34
        c.file = f

        t.clips.append(c)

        # clip 2
        f = File()
        f.duration = 30
        f.name = 'SEQ001_HSNI_003_0020_v001'
        f.pathurl = 'file://localhost/tmp/SEQ001_HSNI_003_0020_v001.mov'

        c = Clip()
        c.id = '0020'
        c.start = 35
        c.end = 65
        c.name = 'SEQ001_HSNI_003_0020_v001'
        c.enabled = True
        c.duration = 30
        c.in_ = 0
        c.out = 30
        c.file = f

        t.clips.append(c)

        # clip 3
        f = File()
        f.duration = 45
        f.name = 'SEQ001_HSNI_003_0030_v001'
        f.pathurl = 'file://localhost/tmp/SEQ001_HSNI_003_0030_v001.mov'

        c = Clip()
        c.id = '0030'
        c.start = 65
        c.end = 110
        c.name = 'SEQ001_HSNI_003_0030_v001'
        c.enabled = True
        c.duration = 45
        c.in_ = 0
        c.out = 45
        c.file = f

        t.clips.append(c)

        expected_xmls = [
            """<?xml version='1.0' encoding='UTF-8'?>
<MetaFuze_BatchTranscode xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="MetaFuzeBatchTranscode.xsd">
   <Configuration>
      <Local>8</Local>
      <Remote>8</Remote>
   </Configuration>
   <Group>
      <FileList>
         <File>\\tmp\\SEQ001_HSNI_003_0010_v001.mov</File>
      </FileList>
      <Transcode>
         <Version>1.0</Version>
         <File>\\tmp\\SEQ001_HSNI_003_0010_v001.mxf</File>
         <ClipName>SEQ001_HSNI_003_0010_v001</ClipName>
         <ProjectName>SEQ001_HSNI_003</ProjectName>
         <TapeName>SEQ001_HSNI_003_0010_v001</TapeName>
         <TC_Start>00:00:00:00</TC_Start>
         <DropFrame>false</DropFrame>
         <EdgeTC>** TimeCode N/A **</EdgeTC>
         <FilmType>35.4</FilmType>
         <KN_Start>AAAAAAAA-0000+00</KN_Start>
         <Frames>33</Frames>
         <Width>1024</Width>
         <Height>778</Height>
         <PixelRatio>1.0000</PixelRatio>
         <UseFilmInfo>false</UseFilmInfo>
         <UseTapeInfo>true</UseTapeInfo>
         <AudioChannelCount>0</AudioChannelCount>
         <UseMXFAudio>false</UseMXFAudio>
         <UseWAVAudio>false</UseWAVAudio>
         <SrcBitsPerChannel>8</SrcBitsPerChannel>
         <OutputPreset>DNxHD 36</OutputPreset>
         <OutputPreset>
            <Version>2.0</Version>
            <Name>DNxHD 36</Name>
            <ColorModel>YCC 709</ColorModel>
            <BitDepth>8</BitDepth>
            <Format>1080 24p</Format>
            <Compression>DNxHD 36</Compression>
            <Conversion>Letterbox (center)</Conversion>
            <VideoFileType>.mxf</VideoFileType>
            <IsDefault>false</IsDefault>
         </OutputPreset>
         <Eye></Eye>
         <Scene></Scene>
         <Comment></Comment>
      </Transcode>
   </Group>
</MetaFuze_BatchTranscode>""",
            """<?xml version='1.0' encoding='UTF-8'?>
<MetaFuze_BatchTranscode xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="MetaFuzeBatchTranscode.xsd">
   <Configuration>
      <Local>8</Local>
      <Remote>8</Remote>
   </Configuration>
   <Group>
      <FileList>
         <File>\\tmp\\SEQ001_HSNI_003_0020_v001.mov</File>
      </FileList>
      <Transcode>
         <Version>1.0</Version>
         <File>\\tmp\\SEQ001_HSNI_003_0020_v001.mxf</File>
         <ClipName>SEQ001_HSNI_003_0020_v001</ClipName>
         <ProjectName>SEQ001_HSNI_003</ProjectName>
         <TapeName>SEQ001_HSNI_003_0020_v001</TapeName>
         <TC_Start>00:00:00:00</TC_Start>
         <DropFrame>false</DropFrame>
         <EdgeTC>** TimeCode N/A **</EdgeTC>
         <FilmType>35.4</FilmType>
         <KN_Start>AAAAAAAA-0000+00</KN_Start>
         <Frames>29</Frames>
         <Width>1024</Width>
         <Height>778</Height>
         <PixelRatio>1.0000</PixelRatio>
         <UseFilmInfo>false</UseFilmInfo>
         <UseTapeInfo>true</UseTapeInfo>
         <AudioChannelCount>0</AudioChannelCount>
         <UseMXFAudio>false</UseMXFAudio>
         <UseWAVAudio>false</UseWAVAudio>
         <SrcBitsPerChannel>8</SrcBitsPerChannel>
         <OutputPreset>DNxHD 36</OutputPreset>
         <OutputPreset>
            <Version>2.0</Version>
            <Name>DNxHD 36</Name>
            <ColorModel>YCC 709</ColorModel>
            <BitDepth>8</BitDepth>
            <Format>1080 24p</Format>
            <Compression>DNxHD 36</Compression>
            <Conversion>Letterbox (center)</Conversion>
            <VideoFileType>.mxf</VideoFileType>
            <IsDefault>false</IsDefault>
         </OutputPreset>
         <Eye></Eye>
         <Scene></Scene>
         <Comment></Comment>
      </Transcode>
   </Group>
</MetaFuze_BatchTranscode>""",
            """<?xml version='1.0' encoding='UTF-8'?>
<MetaFuze_BatchTranscode xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="MetaFuzeBatchTranscode.xsd">
   <Configuration>
      <Local>8</Local>
      <Remote>8</Remote>
   </Configuration>
   <Group>
      <FileList>
         <File>\\tmp\\SEQ001_HSNI_003_0030_v001.mov</File>
      </FileList>
      <Transcode>
         <Version>1.0</Version>
         <File>\\tmp\\SEQ001_HSNI_003_0030_v001.mxf</File>
         <ClipName>SEQ001_HSNI_003_0030_v001</ClipName>
         <ProjectName>SEQ001_HSNI_003</ProjectName>
         <TapeName>SEQ001_HSNI_003_0030_v001</TapeName>
         <TC_Start>00:00:00:00</TC_Start>
         <DropFrame>false</DropFrame>
         <EdgeTC>** TimeCode N/A **</EdgeTC>
         <FilmType>35.4</FilmType>
         <KN_Start>AAAAAAAA-0000+00</KN_Start>
         <Frames>44</Frames>
         <Width>1024</Width>
         <Height>778</Height>
         <PixelRatio>1.0000</PixelRatio>
         <UseFilmInfo>false</UseFilmInfo>
         <UseTapeInfo>true</UseTapeInfo>
         <AudioChannelCount>0</AudioChannelCount>
         <UseMXFAudio>false</UseMXFAudio>
         <UseWAVAudio>false</UseWAVAudio>
         <SrcBitsPerChannel>8</SrcBitsPerChannel>
         <OutputPreset>DNxHD 36</OutputPreset>
         <OutputPreset>
            <Version>2.0</Version>
            <Name>DNxHD 36</Name>
            <ColorModel>YCC 709</ColorModel>
            <BitDepth>8</BitDepth>
            <Format>1080 24p</Format>
            <Compression>DNxHD 36</Compression>
            <Conversion>Letterbox (center)</Conversion>
            <VideoFileType>.mxf</VideoFileType>
            <IsDefault>false</IsDefault>
         </OutputPreset>
         <Eye></Eye>
         <Scene></Scene>
         <Comment></Comment>
      </Transcode>
   </Group>
</MetaFuze_BatchTranscode>""",
        ]

        result = s.to_metafuze_xml()

        self.maxDiff = None
        self.assertEqual(
            expected_xmls[0],
            result[0]
        )
        self.assertEqual(
            expected_xmls[1],
            result[1]
        )
        self.assertEqual(
            expected_xmls[2],
            result[2]
        )
コード例 #3
0
ファイル: test_track.py プロジェクト: yazici/anima
    def test_to_xml_method_with_optimized_clips_is_working_properly(self):
        """testing if the to xml method is working properly with the clips are
        optimized
        """
        t = Track()
        t.enabled = True
        t.locked = False

        # clip 1
        f = File()
        f.duration = 34
        f.name = 'shot2'
        f.pathurl = 'file://localhost/home/eoyilmaz/maya/projects/default/data/shot2.mov'

        c = Clip()
        c.id = 'shot2'
        c.start = 1
        c.end = 35
        c.name = 'shot2'
        c.enabled = True
        c.duration = 34
        c.in_ = 0
        c.out = 34
        c.file = f

        t.clips.append(c)

        # clip 2
        f = File()
        f.duration = 30
        f.name = 'shot'
        f.pathurl = 'file://localhost/home/eoyilmaz/maya/projects/default/data/shot2.mov'

        c = Clip()
        c.id = 'shot2'
        c.start = 35
        c.end = 65
        c.name = 'shot2'
        c.enabled = True
        c.duration = 30
        c.in_ = 0
        c.out = 30
        c.file = f

        t.clips.append(c)

        # clip 3
        f = File()
        f.duration = 45
        f.name = 'shot1'
        f.pathurl = 'file://localhost/home/eoyilmaz/maya/projects/default/data/shot1.mov'

        c = Clip()
        c.id = 'shot1'
        c.start = 65
        c.end = 110
        c.name = 'shot1'
        c.enabled = True
        c.duration = 45
        c.in_ = 0
        c.out = 45
        c.file = f

        t.clips.append(c)

        expected_xml = \
            """<track>
  <locked>FALSE</locked>
  <enabled>TRUE</enabled>
  <clipitem id="shot2">
    <end>35</end>
    <name>shot2</name>
    <enabled>True</enabled>
    <start>1</start>
    <in>0</in>
    <duration>34</duration>
    <out>34</out>
    <file id="shot2.mov">
      <duration>34</duration>
      <name>shot2</name>
      <pathurl>file://localhost/home/eoyilmaz/maya/projects/default/data/shot2.mov</pathurl>
    </file>
  </clipitem>
  <clipitem id="shot2 2">
    <end>65</end>
    <name>shot2</name>
    <enabled>True</enabled>
    <start>35</start>
    <in>0</in>
    <duration>30</duration>
    <out>30</out>
    <file id="shot2.mov"/>
  </clipitem>
  <clipitem id="shot1">
    <end>110</end>
    <name>shot1</name>
    <enabled>True</enabled>
    <start>65</start>
    <in>0</in>
    <duration>45</duration>
    <out>45</out>
    <file id="shot1.mov">
      <duration>45</duration>
      <name>shot1</name>
      <pathurl>file://localhost/home/eoyilmaz/maya/projects/default/data/shot1.mov</pathurl>
    </file>
  </clipitem>
</track>"""

        t.optimize_clips()

        self.assertEqual(expected_xml, t.to_xml())
コード例 #4
0
ファイル: test_video.py プロジェクト: ktSevindik/anima
    def test_to_xml_method_is_working_properly(self):
        """testing if the to xml method is working properly
        """
        v = Video()
        v.width = 1024
        v.height = 778

        t = Track()
        t.enabled = True
        t.locked = False

        v.tracks.append(t)

        # clip 1
        f = File()
        f.duration = 34
        f.name = 'shot2'
        f.pathurl = 'file://localhost/home/eoyilmaz/maya/projects/default/data/shot2.mov'

        c = Clip()
        c.id = 'shot2'
        c.start = 1
        c.end = 35
        c.name = 'shot2'
        c.enabled = True
        c.duration = 34
        c.in_ = 0
        c.out = 34
        c.file = f

        t.clips.append(c)

        # clip 2
        f = File()
        f.duration = 30
        f.name = 'shot'
        f.pathurl = 'file://localhost/home/eoyilmaz/maya/projects/default/data/shot.mov'

        c = Clip()
        c.id = 'shot'
        c.start = 35
        c.end = 65
        c.name = 'shot'
        c.enabled = True
        c.duration = 30
        c.in_ = 0
        c.out = 30
        c.file = f

        t.clips.append(c)

        # clip 3
        f = File()
        f.duration = 45
        f.name = 'shot1'
        f.pathurl = 'file://localhost/home/eoyilmaz/maya/projects/default/data/shot1.mov'

        c = Clip()
        c.id = 'shot1'
        c.start = 65
        c.end = 110
        c.name = 'shot1'
        c.enabled = True
        c.duration = 45
        c.in_ = 0
        c.out = 45
        c.file = f

        t.clips.append(c)

        expected_xml = \
            """<video>
  <format>
    <samplecharacteristics>
      <width>1024</width>
      <height>778</height>
    </samplecharacteristics>
  </format>
  <track>
    <locked>FALSE</locked>
    <enabled>TRUE</enabled>
    <clipitem id="shot2">
      <end>35</end>
      <name>shot2</name>
      <enabled>True</enabled>
      <start>1</start>
      <in>0</in>
      <duration>34</duration>
      <out>34</out>
      <file id="shot2.mov">
        <duration>34</duration>
        <name>shot2</name>
        <pathurl>file://localhost/home/eoyilmaz/maya/projects/default/data/shot2.mov</pathurl>
      </file>
    </clipitem>
    <clipitem id="shot">
      <end>65</end>
      <name>shot</name>
      <enabled>True</enabled>
      <start>35</start>
      <in>0</in>
      <duration>30</duration>
      <out>30</out>
      <file id="shot.mov">
        <duration>30</duration>
        <name>shot</name>
        <pathurl>file://localhost/home/eoyilmaz/maya/projects/default/data/shot.mov</pathurl>
      </file>
    </clipitem>
    <clipitem id="shot1">
      <end>110</end>
      <name>shot1</name>
      <enabled>True</enabled>
      <start>65</start>
      <in>0</in>
      <duration>45</duration>
      <out>45</out>
      <file id="shot1.mov">
        <duration>45</duration>
        <name>shot1</name>
        <pathurl>file://localhost/home/eoyilmaz/maya/projects/default/data/shot1.mov</pathurl>
      </file>
    </clipitem>
  </track>
</video>"""

        self.assertEqual(expected_xml, v.to_xml())
コード例 #5
0
ファイル: test_track.py プロジェクト: yazici/anima
    def test_optimize_clips_is_working_properly(self):
        """testing if the optimize_clips method will optimize the clips to use
        the same file node if the file pathurls are same
        """
        t = Track()
        t.enabled = True
        t.locked = False

        # clip 1
        f = File()
        f.duration = 34
        f.name = 'shot2'
        f.pathurl = 'file://localhost/home/eoyilmaz/maya/projects/default/data/shot2.mov'

        c = Clip()
        c.id = 'shot2'
        c.start = 1
        c.end = 35
        c.name = 'shot2'
        c.enabled = True
        c.duration = 34
        c.in_ = 0
        c.out = 34
        c.file = f

        t.clips.append(c)

        # clip 2
        f = File()
        f.duration = 30
        f.name = 'shot'
        f.pathurl = 'file://localhost/home/eoyilmaz/maya/projects/default/data/shot2.mov'

        c = Clip()
        c.id = 'shot'
        c.start = 35
        c.end = 65
        c.name = 'shot'
        c.enabled = True
        c.duration = 30
        c.in_ = 0
        c.out = 30
        c.file = f

        t.clips.append(c)

        # clip 3
        f = File()
        f.duration = 45
        f.name = 'shot1'
        f.pathurl = 'file://localhost/home/eoyilmaz/maya/projects/default/data/shot1.mov'

        c = Clip()
        c.id = 'shot1'
        c.start = 65
        c.end = 110
        c.name = 'shot1'
        c.enabled = True
        c.duration = 45
        c.in_ = 0
        c.out = 45
        c.file = f

        t.clips.append(c)

        # check if the file objects are different
        self.assertNotEqual(t.clips[0].file, t.clips[1].file)
        self.assertNotEqual(t.clips[0].file, t.clips[2].file)
        self.assertNotEqual(t.clips[1].file, t.clips[2].file)

        # now optimize the clips
        t.optimize_clips()

        # check if the file[0] and file[1] is the same file node
        # and the file[2] is different than the others
        self.assertEqual(t.clips[0].file, t.clips[1].file)
        self.assertNotEqual(t.clips[0].file, t.clips[2].file)
        self.assertNotEqual(t.clips[1].file, t.clips[2].file)
コード例 #6
0
ファイル: test_track.py プロジェクト: theomission/anima
    def test_to_xml_method_is_working_properly(self):
        """testing if the to xml method is working properly
        """
        t = Track()
        t.enabled = True
        t.locked = False

        # clip 1
        f = File()
        f.duration = 34.0
        f.name = 'shot2'
        f.pathurl = 'file:///home/eoyilmaz/maya/projects/default/data/shot2.mov'

        c = Clip()
        c.id = 'shot2'
        c.start = 1.0
        c.end = 35.0
        c.name = 'shot2'
        c.enabled = True
        c.duration = 34.0
        c.in_ = 0.0
        c.out = 34.0
        c.file = f

        t.clips.append(c)

        # clip 2
        f = File()
        f.duration = 30.0
        f.name = 'shot'
        f.pathurl = 'file:///home/eoyilmaz/maya/projects/default/data/shot.mov'

        c = Clip()
        c.id = 'shot'
        c.start = 35.0
        c.end = 65.0
        c.name = 'shot'
        c.enabled = True
        c.duration = 30.0
        c.in_ = 0.0
        c.out = 30.0
        c.file = f

        t.clips.append(c)

        # clip 3
        f = File()
        f.duration = 45.0
        f.name = 'shot1'
        f.pathurl = 'file:///home/eoyilmaz/maya/projects/default/data/shot1.mov'

        c = Clip()
        c.id = 'shot1'
        c.start = 65.0
        c.end = 110.0
        c.name = 'shot1'
        c.enabled = True
        c.duration = 45.0
        c.in_ = 0.0
        c.out = 45.0
        c.file = f

        t.clips.append(c)

        expected_xml = \
            """<track>
  <locked>FALSE</locked>
  <enabled>TRUE</enabled>
  <clipitem id="shot2">
    <end>35.0</end>
    <name>shot2</name>
    <enabled>True</enabled>
    <start>1.0</start>
    <in>0.0</in>
    <duration>34.0</duration>
    <out>34.0</out>
    <file>
      <duration>34.0</duration>
      <name>shot2</name>
      <pathurl>file:///home/eoyilmaz/maya/projects/default/data/shot2.mov</pathurl>
    </file>
  </clipitem>
  <clipitem id="shot">
    <end>65.0</end>
    <name>shot</name>
    <enabled>True</enabled>
    <start>35.0</start>
    <in>0.0</in>
    <duration>30.0</duration>
    <out>30.0</out>
    <file>
      <duration>30.0</duration>
      <name>shot</name>
      <pathurl>file:///home/eoyilmaz/maya/projects/default/data/shot.mov</pathurl>
    </file>
  </clipitem>
  <clipitem id="shot1">
    <end>110.0</end>
    <name>shot1</name>
    <enabled>True</enabled>
    <start>65.0</start>
    <in>0.0</in>
    <duration>45.0</duration>
    <out>45.0</out>
    <file>
      <duration>45.0</duration>
      <name>shot1</name>
      <pathurl>file:///home/eoyilmaz/maya/projects/default/data/shot1.mov</pathurl>
    </file>
  </clipitem>
</track>"""

        self.assertEqual(
            expected_xml,
            t.to_xml()
        )
コード例 #7
0
ファイル: test_track.py プロジェクト: eoyilmaz/anima
    def test_to_xml_method_with_optimized_clips_is_working_properly(self):
        """testing if the to xml method is working properly with the clips are
        optimized
        """
        t = Track()
        t.enabled = True
        t.locked = False

        # clip 1
        f = File()
        f.duration = 34
        f.name = 'shot2'
        f.pathurl = 'file://localhost/home/eoyilmaz/maya/projects/default/data/shot2.mov'

        c = Clip()
        c.id = 'shot2'
        c.start = 1
        c.end = 35
        c.name = 'shot2'
        c.enabled = True
        c.duration = 34
        c.in_ = 0
        c.out = 34
        c.file = f

        t.clips.append(c)

        # clip 2
        f = File()
        f.duration = 30
        f.name = 'shot'
        f.pathurl = 'file://localhost/home/eoyilmaz/maya/projects/default/data/shot2.mov'

        c = Clip()
        c.id = 'shot2'
        c.start = 35
        c.end = 65
        c.name = 'shot2'
        c.enabled = True
        c.duration = 30
        c.in_ = 0
        c.out = 30
        c.file = f

        t.clips.append(c)

        # clip 3
        f = File()
        f.duration = 45
        f.name = 'shot1'
        f.pathurl = 'file://localhost/home/eoyilmaz/maya/projects/default/data/shot1.mov'

        c = Clip()
        c.id = 'shot1'
        c.start = 65
        c.end = 110
        c.name = 'shot1'
        c.enabled = True
        c.duration = 45
        c.in_ = 0
        c.out = 45
        c.file = f

        t.clips.append(c)

        expected_xml = \
            """<track>
  <locked>FALSE</locked>
  <enabled>TRUE</enabled>
  <clipitem id="shot2">
    <end>35</end>
    <name>shot2</name>
    <enabled>True</enabled>
    <start>1</start>
    <in>0</in>
    <duration>34</duration>
    <out>34</out>
    <file id="shot2.mov">
      <duration>34</duration>
      <name>shot2</name>
      <pathurl>file://localhost/home/eoyilmaz/maya/projects/default/data/shot2.mov</pathurl>
    </file>
  </clipitem>
  <clipitem id="shot2 2">
    <end>65</end>
    <name>shot2</name>
    <enabled>True</enabled>
    <start>35</start>
    <in>0</in>
    <duration>30</duration>
    <out>30</out>
    <file id="shot2.mov"/>
  </clipitem>
  <clipitem id="shot1">
    <end>110</end>
    <name>shot1</name>
    <enabled>True</enabled>
    <start>65</start>
    <in>0</in>
    <duration>45</duration>
    <out>45</out>
    <file id="shot1.mov">
      <duration>45</duration>
      <name>shot1</name>
      <pathurl>file://localhost/home/eoyilmaz/maya/projects/default/data/shot1.mov</pathurl>
    </file>
  </clipitem>
</track>"""

        t.optimize_clips()

        self.assertEqual(
            expected_xml,
            t.to_xml()
        )
コード例 #8
0
ファイル: test_track.py プロジェクト: eoyilmaz/anima
    def test_optimize_clips_is_working_properly(self):
        """testing if the optimize_clips method will optimize the clips to use
        the same file node if the file pathurls are same
        """
        t = Track()
        t.enabled = True
        t.locked = False

        # clip 1
        f = File()
        f.duration = 34
        f.name = 'shot2'
        f.pathurl = 'file://localhost/home/eoyilmaz/maya/projects/default/data/shot2.mov'

        c = Clip()
        c.id = 'shot2'
        c.start = 1
        c.end = 35
        c.name = 'shot2'
        c.enabled = True
        c.duration = 34
        c.in_ = 0
        c.out = 34
        c.file = f

        t.clips.append(c)

        # clip 2
        f = File()
        f.duration = 30
        f.name = 'shot'
        f.pathurl = 'file://localhost/home/eoyilmaz/maya/projects/default/data/shot2.mov'

        c = Clip()
        c.id = 'shot'
        c.start = 35
        c.end = 65
        c.name = 'shot'
        c.enabled = True
        c.duration = 30
        c.in_ = 0
        c.out = 30
        c.file = f

        t.clips.append(c)

        # clip 3
        f = File()
        f.duration = 45
        f.name = 'shot1'
        f.pathurl = 'file://localhost/home/eoyilmaz/maya/projects/default/data/shot1.mov'

        c = Clip()
        c.id = 'shot1'
        c.start = 65
        c.end = 110
        c.name = 'shot1'
        c.enabled = True
        c.duration = 45
        c.in_ = 0
        c.out = 45
        c.file = f

        t.clips.append(c)

        # check if the file objects are different
        self.assertNotEqual(t.clips[0].file, t.clips[1].file)
        self.assertNotEqual(t.clips[0].file, t.clips[2].file)
        self.assertNotEqual(t.clips[1].file, t.clips[2].file)

        # now optimize the clips
        t.optimize_clips()

        # check if the file[0] and file[1] is the same file node
        # and the file[2] is different than the others
        self.assertEqual(t.clips[0].file, t.clips[1].file)
        self.assertNotEqual(t.clips[0].file, t.clips[2].file)
        self.assertNotEqual(t.clips[1].file, t.clips[2].file)
コード例 #9
0
ファイル: test_video.py プロジェクト: eoyilmaz/anima
    def test_to_xml_method_is_working_properly(self):
        """testing if the to xml method is working properly
        """
        v = Video()
        v.width = 1024
        v.height = 778

        t = Track()
        t.enabled = True
        t.locked = False

        v.tracks.append(t)

        # clip 1
        f = File()
        f.duration = 34
        f.name = 'shot2'
        f.pathurl = 'file://localhost/home/eoyilmaz/maya/projects/default/data/shot2.mov'

        c = Clip()
        c.id = 'shot2'
        c.start = 1
        c.end = 35
        c.name = 'shot2'
        c.enabled = True
        c.duration = 34
        c.in_ = 0
        c.out = 34
        c.file = f

        t.clips.append(c)

        # clip 2
        f = File()
        f.duration = 30
        f.name = 'shot'
        f.pathurl = 'file://localhost/home/eoyilmaz/maya/projects/default/data/shot.mov'

        c = Clip()
        c.id = 'shot'
        c.start = 35
        c.end = 65
        c.name = 'shot'
        c.enabled = True
        c.duration = 30
        c.in_ = 0
        c.out = 30
        c.file = f

        t.clips.append(c)

        # clip 3
        f = File()
        f.duration = 45
        f.name = 'shot1'
        f.pathurl = 'file://localhost/home/eoyilmaz/maya/projects/default/data/shot1.mov'

        c = Clip()
        c.id = 'shot1'
        c.start = 65
        c.end = 110
        c.name = 'shot1'
        c.enabled = True
        c.duration = 45
        c.in_ = 0
        c.out = 45
        c.file = f

        t.clips.append(c)

        expected_xml = \
            """<video>
  <format>
    <samplecharacteristics>
      <width>1024</width>
      <height>778</height>
    </samplecharacteristics>
  </format>
  <track>
    <locked>FALSE</locked>
    <enabled>TRUE</enabled>
    <clipitem id="shot2">
      <end>35</end>
      <name>shot2</name>
      <enabled>True</enabled>
      <start>1</start>
      <in>0</in>
      <duration>34</duration>
      <out>34</out>
      <file id="shot2.mov">
        <duration>34</duration>
        <name>shot2</name>
        <pathurl>file://localhost/home/eoyilmaz/maya/projects/default/data/shot2.mov</pathurl>
      </file>
    </clipitem>
    <clipitem id="shot">
      <end>65</end>
      <name>shot</name>
      <enabled>True</enabled>
      <start>35</start>
      <in>0</in>
      <duration>30</duration>
      <out>30</out>
      <file id="shot.mov">
        <duration>30</duration>
        <name>shot</name>
        <pathurl>file://localhost/home/eoyilmaz/maya/projects/default/data/shot.mov</pathurl>
      </file>
    </clipitem>
    <clipitem id="shot1">
      <end>110</end>
      <name>shot1</name>
      <enabled>True</enabled>
      <start>65</start>
      <in>0</in>
      <duration>45</duration>
      <out>45</out>
      <file id="shot1.mov">
        <duration>45</duration>
        <name>shot1</name>
        <pathurl>file://localhost/home/eoyilmaz/maya/projects/default/data/shot1.mov</pathurl>
      </file>
    </clipitem>
  </track>
</video>"""

        self.assertEqual(
            expected_xml,
            v.to_xml()
        )