Sha256: 75b7a4a2df092fcdf0764a6edc1aa54d418bc16e9bdbc4912768562cbc88021b

Contents?: true

Size: 821 Bytes

Versions: 5

Compression:

Stored size: 821 Bytes

Contents

#from: https://gist.github.com/52f5c6386fc67e9e6b6b
require 'rubygems'
require 'timecode' # from http://guerilla-di.org/timecode
require 'json'

class MplayerEdl
  attr_reader :edl

  def initialize(edl)
    @edl = edl
  end

  def to_s
    out = []
    edl['events'].each do |event|
      out << ("%0.1f\t%0.1f\t%d" % [
          event['source_in'].to_seconds,
          event['source_out'].to_seconds,
          (event['transition'] == 'cut') ? 0 : 1
        ])
    end
    out.join("\n")
  end
end

edl = JSON.load(IO.read("All Dogs Go To Heaven.json"))
edl['events'].map! do |event|
  event['source_in']  = Timecode.parse(event['source_in'],  edl['film_fps'])
  event['source_out'] = Timecode.parse(event['source_out'], edl['film_fps'])
  event
end

m = MplayerEdl.new(edl)
puts m.to_s

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
sensible-cinema-0.23.0 lib/edl_converter.rb
sensible-cinema-0.22.1 lib/edl_converter.rb
sensible-cinema-0.22.0 lib/edl_converter.rb
sensible-cinema-0.21.10 lib/edl_converter.rb
sensible-cinema-0.21.9 lib/edl_converter.rb