Class: ASXStream
Instance Attribute Summary
Attributes inherited from Stream
#key, #tags
Instance Method Summary
collapse
Methods inherited from Stream
#initialize
Constructor Details
This class inherits a constructor from Stream
Instance Method Details
#entries ⇒ Object
5
6
7
|
# File 'lib/stream2tracks/asx_stream.rb', line 5
def entries
xml.css('ENTRY')
end
|
#parse ⇒ Object
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/stream2tracks/asx_stream.rb', line 9
def parse
title=xml.css('ASX>TITLE')[0]
album=title.inner_text if title
@tags[:album]=album
count=0
tracks=[]
entries.each do |_|
tags=@tags.dup
count+=1
tags.merge!(
:title=>_.css('TITLE').inner_text,
:artist=>_.css('AUTHOR').inner_text,
:track=>count
)
track=Track.new tags,_.css('REF')[0]['HREF']
tracks << track
end
tracks
end
|