Class: TranscodingMachine::Server::FileStorage

Inherits:
Object
  • Object
show all
Defined in:
lib/transcoding_machine/server/file_storage.rb

Instance Method Summary collapse

Constructor Details

#initialize(root_directory = '.') ⇒ FileStorage

Returns a new instance of FileStorage.



4
5
6
# File 'lib/transcoding_machine/server/file_storage.rb', line 4

def initialize(root_directory = '.')
  @root = root_directory
end

Instance Method Details

#get_file(source_file_name, destination_file_path, options) ⇒ Object



8
9
10
11
12
# File 'lib/transcoding_machine/server/file_storage.rb', line 8

def get_file(source_file_name, destination_file_path, options)
  puts File.expand_path(source_file_name, @root)
  puts destination_file_path
  FileUtils.cp(File.expand_path(source_file_name, @root), destination_file_path)
end

#put_file(source_file_path, destination_file_name, media_format, options) ⇒ Object



14
15
16
# File 'lib/transcoding_machine/server/file_storage.rb', line 14

def put_file(source_file_path, destination_file_name, media_format, options)
  FileUtils.mv(source_file_path, File.expand_path(destination_file_name, @root))
end

#put_thumbnail_file(thumbnail_file_path, source_file, options) ⇒ Object



18
19
20
21
# File 'lib/transcoding_machine/server/file_storage.rb', line 18

def put_thumbnail_file(thumbnail_file_path, source_file, options)
  FileUtils.mv(thumbnail_file_path.path, @root)
  thumbnail_file_path.path
end