class MediaInfo
Attributes
streams[RW]
Public Class Methods
new(filename)
click to toggle source
# File lib/mediainfo-simple.rb, line 17 def initialize filename # we check that the file exist raise ArgumentError, "give the filename as a parameter (got nil)" if filename == nil raise ArgumentError, "filename must be a string" if ! filename.is_a? String filename = File.expand_path filename raise ArgumentError, "#{filename} does not exist" if ! File.exist? filename # we parse the file @streams = [] MediaInfoParser.new filename, self end
Public Instance Methods
audio()
click to toggle source
returns an array with all the audio streams
# File lib/mediainfo-simple.rb, line 76 def audio @streams.select { |stream| stream.is_a? AudioStream } end
audio?()
click to toggle source
return true if there is an audio stream, false otherwise
# File lib/mediainfo-simple.rb, line 41 def audio? @streams.any? { |stream| stream.is_a? AudioStream } end
general()
click to toggle source
returns an array with all the video streams
# File lib/mediainfo-simple.rb, line 66 def general @streams.select { |stream| stream.is_a? GeneralStream } end
general?()
click to toggle source
return true if there is a general stream, false otherwise
# File lib/mediainfo-simple.rb, line 31 def general? @streams.any? { |stream| stream.is_a? GeneralStream } end
image()
click to toggle source
returns an array with all the image streams
# File lib/mediainfo-simple.rb, line 86 def image @streams.select { |stream| stream.is_a? ImageStream } end
image?()
click to toggle source
return true if there is an image stream, false otherwise
# File lib/mediainfo-simple.rb, line 51 def image? @streams.any? { |stream| stream.is_a? ImageStream } end
other()
click to toggle source
returns an array with all the other streams
# File lib/mediainfo-simple.rb, line 96 def other @streams.select { |stream| stream.is_a? OtherStream } end
other?()
click to toggle source
return true if there is an undefined stream, false otherwise
# File lib/mediainfo-simple.rb, line 61 def other? @streams.any? { |stream| stream.is_a? OtherStream } end
text()
click to toggle source
returns an array with all the text streams
# File lib/mediainfo-simple.rb, line 81 def text @streams.select { |stream| stream.is_a? TextStream } end
text?()
click to toggle source
return true if there is a text stream, false otherwise
# File lib/mediainfo-simple.rb, line 46 def text? @streams.any? { |stream| stream.is_a? TextStream } end
video()
click to toggle source
returns an array with all the video streams
# File lib/mediainfo-simple.rb, line 71 def video @streams.select { |stream| stream.is_a? VideoStream } end
video?()
click to toggle source
return true if there is a video stream, false otherwise
# File lib/mediainfo-simple.rb, line 36 def video? @streams.any? { |stream| stream.is_a? VideoStream } end