Class: Jani::StripMaker::Movie
- Inherits:
-
Object
- Object
- Jani::StripMaker::Movie
- Includes:
- Magick
- Defined in:
- lib/jani/strip_maker/movie.rb
Constant Summary collapse
- FILE_NAME_PATTERN =
"frame%4d"
- FILE_NAME_EXTENTION =
"jpg"
Instance Method Summary collapse
-
#initialize(movie_filepath: "", transcode_options: nil) ⇒ Movie
constructor
A new instance of Movie.
- #to_frame_list ⇒ Object
- #to_strips ⇒ Object
Constructor Details
#initialize(movie_filepath: "", transcode_options: nil) ⇒ Movie
Returns a new instance of Movie.
10 11 12 13 14 15 16 |
# File 'lib/jani/strip_maker/movie.rb', line 10 def initialize(movie_filepath: "", transcode_options: nil) raise "Specify file path of movie and transcode options" if movie_filepath.empty? || .nil? @movie_filepath = (movie_filepath) @transcode_options = @_frame_list = [] end |
Instance Method Details
#to_frame_list ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/jani/strip_maker/movie.rb', line 18 def to_frame_list return @_frame_list unless @_frame_list.empty? movie_full_path = movie_full_path() Dir.mktmpdir do |tmp_dir| Dir.chdir(tmp_dir) do |dir| execute_ffmpeg_command(movie_full_path) images = ImageList.new(*Dir.glob("*\.#{FILE_NAME_EXTENTION}")).sort_by(&:filename) # TODO: raise error if images is empty @_frame_list = Jani::StripMaker::FrameList.new(images: images) end end end |
#to_strips ⇒ Object
31 32 33 |
# File 'lib/jani/strip_maker/movie.rb', line 31 def to_strips to_frame_list().to_strips() end |