Class: Vera::Lister

Inherits:
Object
  • Object
show all
Defined in:
lib/vera/lister.rb

Class Method Summary collapse

Class Method Details

.all_files(path, ext) ⇒ Object



5
6
7
8
9
# File 'lib/vera/lister.rb', line 5

def self.all_files(path, ext)
  Dir.entries(path)
     .map { |file| { path: "#{path}/#{file}", filename: file } }
     .select { |file| ext == File.extname(file[:filename]).gsub('.', '') }
end

.all_media_files_recursive(path) ⇒ Object



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

def self.all_media_files_recursive(path)
  `find #{path.gsub(' ', '\ ')} -type f | grep -E "#{MediaType.all.join('|')}"`.split("\n")
end