class Nehm::SearchCommand
Public Class Methods
new()
click to toggle source
Calls superclass method
# File lib/nehm/commands/search_command.rb, line 7 def initialize super add_option(:"-t", '-t PATH', 'Download track(s) to PATH') add_option(:"-pl", '-pl PLAYLIST', 'Add track(s) to iTunes playlist with PLAYLIST name') add_option(:"-lim", '-lim NUMBER', 'Show NUMBER tracks on each page') add_option(:"-dl", '-dl yes', "Don't add tracks to iTunes. Just download and set tags") end
Public Instance Methods
arguments()
click to toggle source
# File lib/nehm/commands/search_command.rb, line 41 def arguments { 'QUERY' => 'Search query' } end
execute()
click to toggle source
Calls superclass method
# File lib/nehm/commands/search_command.rb, line 24 def execute # Convert dash-options to normal options options_to_convert = { :"-t" => :to, :"-pl" => :pl, :"-lim" => :limit, :"-dl" => :dl } options_to_convert.each do |k, v| value = @options[k] @options.delete(k) @options[v] = value unless value.nil? end @query = @options[:args].join(' ') super end
program_name()
click to toggle source
# File lib/nehm/commands/search_command.rb, line 45 def program_name 'nehm search' end
summary()
click to toggle source
# File lib/nehm/commands/search_command.rb, line 49 def summary 'Search tracks, print them nicely and download, set tags and add ' \ 'to iTunes selected' end
usage()
click to toggle source
# File lib/nehm/commands/search_command.rb, line 54 def usage "#{program_name} QUERY [OPTIONS]" end
Protected Instance Methods
get_tracks()
click to toggle source
# File lib/nehm/commands/search_command.rb, line 60 def get_tracks UI.term 'You must provide a query' if @query.empty? @track_manager.search(@query, @limit, @offset) end