Module: Nehm

Defined in:
lib/nehm.rb,
lib/nehm/os.rb,
lib/nehm/ui.rb,
lib/nehm/cfg.rb,
lib/nehm/menu.rb,
lib/nehm/track.rb,
lib/nehm/client.rb,
lib/nehm/artwork.rb,
lib/nehm/command.rb,
lib/nehm/version.rb,
lib/nehm/playlist.rb,
lib/nehm/applescript.rb,
lib/nehm/http_client.rb,
lib/nehm/path_manager.rb,
lib/nehm/user_manager.rb,
lib/nehm/option_parser.rb,
lib/nehm/track_manager.rb,
lib/nehm/command_manager.rb,
lib/nehm/playlist_manager.rb,
lib/nehm/commands/dl_command.rb,
lib/nehm/tracks_view_command.rb,
lib/nehm/commands/get_command.rb,
lib/nehm/commands/help_command.rb,
lib/nehm/commands/search_command.rb,
lib/nehm/commands/select_command.rb,
lib/nehm/commands/version_command.rb,
lib/nehm/commands/configure_command.rb

Defined Under Namespace

Modules: AppleScript, Cfg, Client, CommandManager, OS, PathManager, PlaylistManager, UI, UserManager Classes: Artwork, Command, ConfigureCommand, DlCommand, GetCommand, HTTPClient, HelpCommand, OptionParser, Playlist, SearchCommand, SelectCommand, Track, TrackManager, TracksViewCommand, VersionCommand

Constant Summary collapse

HELP =
"\#{'nehm'.green} is a console tool, which downloads, sets IDv3 tags and adds to your iTunes library your SoundCloud posts or likes in convenient way\n\n\#{'Available nehm commands:'.yellow}\n  \#{'get'.green}        Download, set tags and add to your iTunes library last post or like from your profile\n  \#{'dl'.green}         Download and set tags last post or like from your profile\n  \#{'configure'.green}  Configure application\n  \#{'help'.green}       Show help for specified command\n  \#{'search'.green}     Search tracks, print them nicely and download selected tracks\n  \#{'select'.green}     Get likes or posts from your account, nicely print them and download selected tracks\n  \#{'version'.green}    Show version of installed nehm\n\nSee \#{'nehm help COMMAND'.yellow} to read about a specific command\n\nCommands and arguments (but NOT options) may be abbreviated, so long as they are unambiguous.\ne.g. 'nehm g l' is short for 'nehm get like'.\n"
VERSION =
'2.1.4'.freeze

Class Method Summary collapse

Class Method Details

.initObject



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/nehm.rb', line 46

def init
  UI.say 'Hello!'.green
  UI.say 'Before using the nehm, you should set it up:'
  Cfg.create unless Cfg.exist?

  PathManager.set_dl_path
  UI.newline

  UserManager.set_uid
  UI.newline

  if OS.mac?
    PlaylistManager.set_playlist
    UI.newline
  end

  UI.success "Now you can use nehm!"
  UI.newline

  UI.sleep
end

.initialized?Boolean

Returns:

  • (Boolean)


68
69
70
# File 'lib/nehm.rb', line 68

def initialized?
  Cfg.exist?
end

.start(args) ⇒ Object



15
16
17
18
19
20
21
22
23
24
# File 'lib/nehm.rb', line 15

def self.start(args)
  init unless initialized?

  if args.empty?
    UI.say HELP
    UI.term
  end

  CommandManager.run(args)
end