lib/mxfinfo.rb in mxfinfo-0.0.1 vs lib/mxfinfo.rb in mxfinfo-0.0.2

- old
+ new

@@ -30,12 +30,16 @@ def self.supported_attributes; @supported_attributes ||= []; end def initialize(input, process = true) if process @filepath = File.absolute_path(input) - File.exists?(@filepath.shellescape) ? @valid = true : @valid = false - @mxfinfo = mxfinfo if (process && @valid) + File.exists?(@filepath) ? @valid = true : @valid = false + if @valid + @mxfinfo = mxfinfo + # Check if output contains error from binary + @mxfinfo.include?("ERROR") ? @valid = false : @valid = true + end else @valid = true @mxfinfo = input end process_data if @valid @@ -93,10 +97,10 @@ mxfinfo_attr_reader :physical_package_locator private def mxfinfo # TODO: - add check if return data is valid - `#{MXFinfo.binary} #{@filepath.shellescape}` + `#{MXFinfo.binary} #{@filepath.shellescape} 2>&1` end def process_data @processed_data = Hash.new @mxfinfo.each_line do |line|