Class: LastDup::Cli

Inherits:
Object
  • Object
show all
Includes:
Helper, Singleton
Defined in:
lib/last-dup/cli.rb

Instance Method Summary collapse

Methods included from Helper

#gather_music_folders

Instance Method Details

#runObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/last-dup/cli.rb', line 9

def run

  if Settings.rest.empty?
    input_folder = "."
  else
    input_folder = Settings.rest[0]
  end

  input_folder = File.expand_path(input_folder)

  unless File.directory?(input_folder)
    puts "#{input_folder} is not a valid folder!"
  end

  music_folders = gather_music_folders(input_folder)
  lastfm = LastfmEnquirer.instance

  music_folders.each do |folder_name|
    album = Album.new(folder_name)
    next unless album.tags_are_present?(:artist, :album_title)
    if lastfm.i_have_heart_this?(album)
      puts "#{album.[:artist]} - #{album.[:album_title]}"
    end
  end

end