Class: Onsen

Inherits:
WebRadio show all
Defined in:
lib/onsen.rb

Instance Method Summary collapse

Methods inherited from WebRadio

instance

Constructor Details

#initialize(params, options) ⇒ Onsen

Returns a new instance of Onsen.



7
8
9
10
# File 'lib/onsen.rb', line 7

def initialize(params, options)
	super
	@cover = "//*[@id='newProgramWrap']//img[1]/@src" unless @cover
end

Instance Method Details

#downloadObject



12
13
14
# File 'lib/onsen.rb', line 12

def download
	onsen_download(@label, @url.scan(%r|/([^/]*)/$|).flatten.first)
end

#dumpObject



16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/onsen.rb', line 16

def dump
	tag = Pathname(@url).basename.to_s.gsub(%r|[-/]|, '_')
	html = Nokogiri(open(@url, &:read))
	title = html.css('#outLineWrap h1').text
	return {
		tag => {
			'desc' => title,
			'url' => @url,
			'label' => tag
		}
	}
end