Class: Hibiki

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

Instance Method Summary collapse

Methods inherited from WebRadio

instance

Constructor Details

#initialize(url, options) ⇒ Hibiki

Returns a new instance of Hibiki.



10
11
12
13
# File 'lib/hibiki.rb', line 10

def initialize(url, options)
	super
	@url = @url.sub(%r|/detail\Z|, '')
end

Instance Method Details

#downloadObject



15
16
17
# File 'lib/hibiki.rb', line 15

def download
	hibiki_download(@label, Pathname(@url).basename.to_s)
end

#dumpObject



19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/hibiki.rb', line 19

def dump
	tag = Pathname(@url).basename.to_s.gsub(%r|[-/]|, '_')
	agent = Mechanize.new
	media_info = hibiki_media_info(agent, tag)

	return {
		tag => {
			'desc' => media_info[:name],
			'url' => @url,
			'label' => tag
		}
	}
end