lib/mediainfo.rb in mediainfo-1.2.0 vs lib/mediainfo.rb in mediainfo-1.2.1

- old
+ new

@@ -22,11 +22,12 @@ if ENV['MEDIAINFO_PATH'].nil? mediainfo_location = which('mediainfo') else mediainfo_location = ENV['MEDIAINFO_PATH'] end - raise EnvironmentError, "#{mediainfo_location} cannot be found. Are you sure mediainfo is installed?" unless ::File.exist? mediainfo_location + raise EnvironmentError, "MediaInfo binary cannot be found. Are you sure mediainfo is installed?" if which('mediainfo').nil? + raise EnvironmentError, "MediaInfo path you provided cannot be found. Please check your mediainfo installation location..." unless ::File.exist? mediainfo_location return mediainfo_location end # Allow collection of MediaInfo version details def self.version @@ -96,14 +97,12 @@ end def self.from_uri(input) http = Net::HTTP.new(input.host, input.port) # Check if input is valid request = Net::HTTP::Head.new(input.request_uri) # Only grab the Headers to be sure we don't try and download the whole file - http.use_ssl = true if input.is_a? URI::HTTPS # For https support - - raise RemoteUrlError, "HTTP call to #{input} is not working!" unless http.request(request).is_a?(Net::HTTPOK) - + http_request = http.request(request) + raise RemoteUrlError, "HTTP call to #{input} is not working : #{http_request.value}" unless http_request.is_a?(Net::HTTPOK) MediaInfo::Tracks.new(MediaInfo.run(URI.escape(input.to_s))) end def self.set_singleton_method(object,name,parameters) # Handle parameters with invalid characters (instance_variable_set throws error)