Class: Plexify::Prepare::Source

Inherits:
Object
  • Object
show all
Defined in:
lib/plexify/prepare.rb

Overview

Source class implementation

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Source

Initialize



74
75
76
77
# File 'lib/plexify/prepare.rb', line 74

def initialize(options)
  @source_path = options[:source]
  @files = Array.new
end

Instance Attribute Details

#filesObject

Returns the value of attribute files.



71
72
73
# File 'lib/plexify/prepare.rb', line 71

def files
  @files
end

#folderObject

Returns the value of attribute folder.



70
71
72
# File 'lib/plexify/prepare.rb', line 70

def folder
  @folder
end

Instance Method Details

#prepareObject

Prepare source folder



80
81
82
83
84
85
86
87
88
# File 'lib/plexify/prepare.rb', line 80

def prepare
  @folder = File.new @source_path

  if File.exists?(@folder.path) && File.directory?(@folder.path)
    Dir.glob(@folder.path + "/**/*.{mkv,avi,mov}") do |file|
      @files << File.open(file)
    end
  end
end