Class: VideoExtractor
- Inherits:
-
Object
- Object
- VideoExtractor
- Defined in:
- lib/filentory/videoextractor.rb
Class Method Summary collapse
-
.handles?(file_extension) ⇒ Boolean
Check if VideoExtractor handles the file extension.
Instance Method Summary collapse
-
#metadata_for_file(file_path) ⇒ Object
Extracts the metadata of a file at a given path in the file system.
Class Method Details
.handles?(file_extension) ⇒ Boolean
Check if VideoExtractor handles the file extension. Example: VideoExtractor.handles? “.mov” => returns true
20 21 22 |
# File 'lib/filentory/videoextractor.rb', line 20 def self.handles?(file_extension) [".avi", ".mpeg", ".mov", ".mp4", ".flv"].include? file_extension end |
Instance Method Details
#metadata_for_file(file_path) ⇒ Object
Extracts the metadata of a file at a given path in the file system.
6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/filentory/videoextractor.rb', line 6 def (file_path) movie = FFMPEG::Movie.new(file_path) result = Hash.new methods = define_fields methods.each{|m| result[m] = movie.send(m)} add_creation_time(movie, result) result.delete_if { |k, v| v.nil? || v.to_s.empty?} end |