Class: AudioAddict::Commands::DownloadCmd

Inherits:
Base
  • Object
show all
Defined in:
lib/audio_addict/commands/download.rb

Instance Method Summary collapse

Methods inherited from Base

#current_channel, #current_network, #needs, #prompt, #radio, #require_premium_account

Instance Method Details

#current_commandObject



30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/audio_addict/commands/download.rb', line 30

def current_command
  needs :network, :channel

  say '!txtblu!Downloading !txtrst!: ... '

  track = current_channel.current_track
  query = track.search_string

  resay "!txtblu!Downloading !txtgrn!: #{query}"

  Youtube.new(query).get count
end

#log_commandObject



43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/audio_addict/commands/download.rb', line 43

def log_command
  needs :like_log
  lines = args['--lines']&.to_i

  data = log.data[-lines..]
  data.each do |line|
    _network, _channel, artist, song = line.split(' :: ')
    query = "#{artist}, #{song}"
    say "\n!txtblu!Downloading !txtgrn!: #{query}"
    Youtube.new(query).get count
  end
end

#search_commandObject



56
57
58
59
60
61
# File 'lib/audio_addict/commands/download.rb', line 56

def search_command
  query = args['QUERY']

  say "\n!txtblu!Downloading !txtgrn!: #{query}"
  Youtube.new(query).get count
end