Module: VkMusicLoader
- Defined in:
- lib/vk_music_loader.rb,
lib/vk_music_loader/version.rb,
lib/vk_music_loader/authorizer.rb,
lib/vk_music_loader/songs_downloader.rb
Defined Under Namespace
Classes: Authorizer, SongsDownloader
Constant Summary collapse
- VERSION =
'0.3.1'
Class Method Summary collapse
Class Method Details
.call ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/vk_music_loader.rb', line 16 def self.call begin opts = Slop.parse uppress_errors: true do |o| o.string 'key', '-key', '--key', '-k' o.integer 'id', '-id', '--id', '-user-id', '--user-id', '-group-id', '--group-id' o.string 'query', '-query', '--query', '-q', 'search', '-search', '--search' o.integer 'count', '-count', '--count', 'c', '-c', '--c' o.string 'folder', '-folder', '--folder', 'path', '-path', '--path', '-p', default: 'audio' o.bool 'random', '-random', '--random', 'shuffle', '-shuffle', '--shuffle', '-r' end if opts[:id] || opts[:query] auth_token = VkMusicLoader::Authorizer.new(opts[:key]).perform VkMusicLoader::SongsDownloader.new(auth_token, opts).perform else puts 'No user id or group id or query' end rescue Slop::Error => e puts e. end end |