Sha256: 0c58a35d680638852e500ac76ec287eae7291d7dccf3b560bbd15ac5dba8aae0
Contents?: true
Size: 858 Bytes
Versions: 2
Compression:
Stored size: 858 Bytes
Contents
# -*- coding: utf-8 -*- GrooveDl::CLI.options.command 'search' do banner 'Usage: groove-dl search [OPTIONS]' description 'Search for something on GrooveShark' separator "\nOptions:\n" on :p=, :playlist=, 'Playlist', as: String on :s=, :song=, 'Song', as: String run do |opts| next if opts[:p].nil? && opts[:a].nil? && opts[:s].nil? client = Grooveshark::Client.new type = 'Songs' if opts[:s] type = 'Playlists' if opts[:p] query = opts[:s] if opts[:s] query = opts[:p] if opts[:p] results = client.request('getResultsFromSearch', type: type, query: query)['result'] results.map! do |data| next Grooveshark::Song.new data if type == 'Songs' data end displayer = GrooveDl::Displayer.new(results, type) displayer.render end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
groove-dl-0.2.0 | lib/groove-dl/cli/search.rb |
groove-dl-0.1.0 | lib/groove-dl/cli/search.rb |