Skip to content

Instantly share code, notes, and snippets.

@pvdb
Created May 18, 2009 17:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pvdb/113629 to your computer and use it in GitHub Desktop.
Save pvdb/113629 to your computer and use it in GitHub Desktop.
private
def mediainfo!
# ANSI-C quoting: http://www.faqs.org/docs/bashman/bashref_12.html
@escaped_full_filename = @full_filename.gsub(/\\|'/) { |c| "\\#{c}" }
raw_response = `#{@mediainfo_binary} $'#{@escaped_full_filename}'`
raise "Execution of #{mediainfo_binary} failed!" unless $? == 0
return raw_response
end
>> require 'mediainfo'
=> true
>> mediainfo = Mediainfo.new "foo(bar).mov"
=> #<Mediainfo:0xb79f6304 @mediainfo_binary="mediainfo", @raw_response="...", @path=".", @escaped_full_filename="foo(bar).mov", @full_filename="foo(bar).mov", @filename="foo(bar).mov", @parsed_response={...}
>> mediainfo.nil?
=> false
>> mediainfo.video?
=> true
>> mediainfo.audio?
=> true
>> exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment