Class: ButterCut

Inherits:
Object
  • Object
show all
Defined in:
lib/buttercut.rb,
lib/buttercut/fcp7.rb,
lib/buttercut/fcpx.rb,
lib/buttercut/version.rb,
lib/buttercut/editor_base.rb

Overview

ButterCut - Video editor XML generator

Factory class that creates editor-specific generators based on the editor parameter. Currently supports:

- :fcpx - Final Cut Pro X (FCPXML 1.8 format)
- :fcp7 - Final Cut Pro 7 XML (xmeml version 5)

Example usage:

clips = [
  { path: '/absolute/path/to/video1.mov', start_at: 2.0, duration: 5.0 },
  { path: '/absolute/path/to/video2.mov' }
]
generator = ButterCut.new(clips, editor: :fcpx)
generator.save('output.fcpxml')

Defined Under Namespace

Classes: EditorBase, FCP7, FCPX

Constant Summary collapse

SUPPORTED_EDITORS =
[:fcpx, :fcp7].freeze
VERSION =
"0.5.0"

Class Method Summary collapse

Class Method Details

.new(clips, editor:) ⇒ Object

Raises:

  • (ArgumentError)


21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/buttercut.rb', line 21

def self.new(clips, editor:)
  raise ArgumentError, "editor: parameter is required" if editor.nil?

  unless SUPPORTED_EDITORS.include?(editor)
    raise ArgumentError, "Unsupported editor: #{editor.inspect}. Supported editors: #{SUPPORTED_EDITORS.map(&:inspect).join(', ')}"
  end

  case editor
  when :fcpx
    ButterCut::FCPX.new(clips)
  when :fcp7
    ButterCut::FCP7.new(clips)
  else
    raise ArgumentError, "Editor #{editor.inspect} is not yet implemented."
  end
end