class MovieMasher::MetaReader
used to parse file's meta data
Public Class Methods
new(path)
click to toggle source
Calls superclass method
MovieMasher::Hashable::new
# File lib/util/meta_reader.rb, line 6 def initialize(path) # sequence outputs point to a directory path = Dir[Path.concat path, '*'].first if File.directory?(path) @path = path super({}) end
Public Instance Methods
[](symbol)
click to toggle source
Calls superclass method
MovieMasher::Hashable#[]
# File lib/util/meta_reader.rb, line 13 def [](symbol) @hash[symbol] ||= _meta(symbol) super end
_info()
click to toggle source
# File lib/util/meta_reader.rb, line 18 def _info Info.get(@path, __callee__.id2name) end
Also aliased as: audio, audio_duration, dimensions, duration, ffmpeg, fps, http, sox, type, video_duration
_meta(symbol)
click to toggle source
# File lib/util/meta_reader.rb, line 22 def _meta(symbol) s = ffmpeg metas = s.split('Metadata:') metas.shift unless metas.empty? sym_str = symbol.id2name metas.each do |meta| lines = meta.split "\n" lines.shift if lines.first.strip.empty? first_line = lines.first pad = first_line.match(/(\s+)\S/)[1] lines.each do |line| break unless line.start_with? pad pair = line.split(':').map(&:strip) return pair.last if pair.first == sym_str end end end '' end