module Elasticmusic::Importer

Public Class Methods

file(path) click to toggle source
# File lib/elasticmusic/importer.rb, line 5
def file(path)
  song = Elasticmusic::Song.new(path: path)
  song.set_metatags
  song.save
  song
end
folder(path) click to toggle source
# File lib/elasticmusic/importer.rb, line 12
def folder(path)
  files = Dir.glob(File.join(path, '**', '*')).select do |f|
    File.file?(f) && Elasticmusic::SUPPORTED_FORMATS.include?(File.extname(f).downcase)
  end

  files.each do |file_path|
    self.file(file_path)
  end
end