Module: VideoScreenshoter

Defined in:
lib/video_screenshoter.rb,
lib/video_screenshoter/hls.rb,
lib/video_screenshoter/image.rb,
lib/video_screenshoter/video.rb,
lib/video_screenshoter/version.rb,
lib/video_screenshoter/abstract.rb

Defined Under Namespace

Classes: Abstract, Hls, Image, Video

Constant Summary collapse

VERSION =
"0.2.3"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.ffmpegObject

Returns the value of attribute ffmpeg.



11
12
13
# File 'lib/video_screenshoter.rb', line 11

def ffmpeg
  @ffmpeg
end

.imagemagickObject

Returns the value of attribute imagemagick.



11
12
13
# File 'lib/video_screenshoter.rb', line 11

def imagemagick
  @imagemagick
end

.output_dirObject

Returns the value of attribute output_dir.



11
12
13
# File 'lib/video_screenshoter.rb', line 11

def output_dir
  @output_dir
end

.output_fileObject

Returns the value of attribute output_file.



11
12
13
# File 'lib/video_screenshoter.rb', line 11

def output_file
  @output_file
end

.verboseObject

Returns the value of attribute verbose.



11
12
13
# File 'lib/video_screenshoter.rb', line 11

def verbose
  @verbose
end

Class Method Details

.new(params) ⇒ Object

Raises:

  • (ArgumentError)


19
20
21
22
23
24
25
26
27
28
29
# File 'lib/video_screenshoter.rb', line 19

def self.new params
  raise ArgumentError.new('Input is needed') unless params[:input]
  raise ArgumentError.new('Incorrect type param') unless [nil, 'hls', 'video', 'image'].include? params[:type]
  if params[:type] == 'hls' || File.extname(params[:input]).downcase == '.m3u8'
    VideoScreenshoter::Hls.new(params)
  elsif params[:type] == 'image' || ['.gif','.png','.jpg','.jpeg', '.png'].include?(File.extname(params[:input]).downcase)
    VideoScreenshoter::Image.new(params)
  else
    VideoScreenshoter::Video.new(params)
  end
end