Class: Plotline::Import::Handlers::VideoFile

Inherits:
Base
  • Object
show all
Defined in:
lib/plotline/import/handlers/video_file.rb

Constant Summary collapse

IMAGE_EXTENSIONS =
%w(mov mp4 avi wmv).freeze

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Plotline::Import::Handlers::Base

Instance Method Details

#import(filename) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/plotline/import/handlers/video_file.rb', line 11

def import(filename)
  log "\e[34mImporting:\e[0m #{filename}"

  if !File.exists?(filename)
    log "FILE REMOVED"
    return
  end

  dst = filename.gsub(@runner.source_dir, @runner.uploads_dir)

  FileUtils.mkdir_p(File.dirname(dst))
  FileUtils.cp(filename, dst)
end

#supported_file?(filename) ⇒ Boolean

Returns:

  • (Boolean)


7
8
9
# File 'lib/plotline/import/handlers/video_file.rb', line 7

def supported_file?(filename)
  IMAGE_EXTENSIONS.include?(File.extname(filename).gsub('.', ''))
end