Class: Mixtape::YoutubePlaylist

Inherits:
Object
  • Object
show all
Defined in:
lib/mixtape/youtube_playlist.rb

Defined Under Namespace

Classes: InvalidSource

Constant Summary collapse

URL =
"http://youtube.com"

Instance Method Summary collapse

Constructor Details

#initialize(songs) ⇒ YoutubePlaylist

Returns a new instance of YoutubePlaylist.



6
7
8
# File 'lib/mixtape/youtube_playlist.rb', line 6

def initialize(songs)
  @songs = songs
end

Instance Method Details

#urlObject



10
11
12
13
14
15
16
17
# File 'lib/mixtape/youtube_playlist.rb', line 10

def url
  #TODO deal with imposible searches in each source before sending them to youtube
  #, until then i'll use compact and return less songs
  ids = @songs.pmap do |song|
    video_id(song)
  end.compact
  playlist_url ids
end