lib/xmorph/util.rb in xmorph-0.1.14 vs lib/xmorph/util.rb in xmorph-0.1.16

- old
+ new

@@ -8,29 +8,31 @@ begin response_json = Hash.from_xml(response) response_json["Mediainfo"]["File"]["track"].each do |track| type = track['type'] track = track.except("type") - track['Encoding_settings'] = Rack::Utils.parse_nested_query(track['Encoding_settings'].split("/").map {|pair| pair.strip }.join("&")) unless track['Encoding_settings'].nil? (type == "Audio") ? meta["Audio"] << track : meta[type] = track if type == "Video" + aspect_ratio = nil if track["Display_aspect_ratio"].present? - track["Display_aspect_ratio"] = track["Display_aspect_ratio"] if track["Display_aspect_ratio"].include? (":") + aspect_ratio = track["Display_aspect_ratio"] if track["Display_aspect_ratio"].include? (":") end - if track["Original_display_aspect_ratio"].present? - track["Display_aspect_ratio"] = track["Original_display_aspect_ratio"] if track["Original_display_aspect_ratio"].include? (":") + if aspect_ratio.nil? and track["Original_display_aspect_ratio"].present? + aspect_ratio = track["Original_display_aspect_ratio"] if track["Original_display_aspect_ratio"].include? (":") end + track["Display_aspect_ratio"] = aspect_ratio if aspect_ratio.present? end end meta['audio_tracks'] = meta['Audio'].count.to_s rescue => ex puts ex return false, {"error" => "Failed to load mediainfo"} end return true, meta - end + end def self.run_cmd_with_response(cmd) + XMorph::Base.logger.info("Util#run_cmd_with_response: command: #{cmd}") raw_response = `#{cmd}` successful = true exit_status = $?.exitstatus if exit_status != 0 successful = false