Module: VkMusic::Utility::PlaylistSectionLoader
- Defined in:
- lib/vk_music/utility/playlist_section_loader.rb
Overview
Load sections into playlist
Class Method Summary collapse
Class Method Details
.call(agent, client_id, owner_id, playlist_id, access_hash, offset, up_to) ⇒ Array<Audio>
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/vk_music/utility/playlist_section_loader.rb', line 15 def self.call(agent, client_id, owner_id, playlist_id, access_hash, offset, up_to) audios = [] while audios.size < up_to section = Request::PlaylistSection.new(owner_id, playlist_id, access_hash, offset + audios.size, client_id) section.call(agent) audios.concat(section.audios) break if section.audios.empty? || !section.more? end audios.first(up_to) end |