Class: Framecurve::Extractors::FCP_XML

Inherits:
Object
  • Object
show all
Defined in:
lib/framecurve/extractors/fcp_xml.rb

Overview

Pulls all varispeed timeremaps from an FCP XML V4 file

Instance Method Summary collapse

Constructor Details

#initializeFCP_XML

Returns a new instance of FCP_XML.



9
10
11
# File 'lib/framecurve/extractors/fcp_xml.rb', line 9

def initialize()
  @xml = Framecurve::XMLBridge.new
end

Instance Method Details

#extract(io) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/framecurve/extractors/fcp_xml.rb', line 13

def extract(io)
  doc = @xml.document_from_io(io)
  # Find all of the parameterid elements with graphdict
  @xml.xpath_each(doc, "//parameterid") do | e |
    if @xml.element_text(e) == "graphdict"
      parameter = @xml.parent(e)
      effect = @xml.parent(e, 2)
      if @xml.xpath_first_text(effect, "name") == "Time Remap"
        $stderr.puts "Found a timewarp at %s" % parameter.xpath
        
        curve = pull_timewarp(parameter, File.basename(io.path))
        destination = compose_filename(io.path, parameter)
        
        File.open(destination, "wb") do | f |
          $stderr.puts "Writing out a framecurve to %s" % destination
          Framecurve::Serializer.new.validate_and_serialize(f, curve)
        end
      end
    end
  end
end