Class: WebRadio
- Inherits:
-
Object
show all
- Defined in:
- lib/webradio.rb
Defined Under Namespace
Classes: DownloadError, NotFoundError
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(params, options) ⇒ WebRadio
Returns a new instance of WebRadio.
30
31
32
33
34
35
36
37
38
39
40
|
# File 'lib/webradio.rb', line 30
def initialize(params, options)
raise 'do not instanciate directly, use WebRadio method.' if self.class == WebRadio
@url = params['url']
@label = params['label']
@cover = params['cover']
@options = options
if !@options.dump && @options.path =~ %r|^dropbox://|
require 'dropbox'
@dropbox = RGet::Dropbox.client
end
end
|
Class Method Details
.instance(params, options) ⇒ Object
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/webradio.rb', line 11
def self.instance(params, options)
case params['url']
when %r[^http://hibiki-radio\.jp/]
require 'hibiki'
Hibiki.new(params, options)
when %r[^http://(www\.)?onsen\.ag/program/]
require 'onsen'
Onsen.new(params, options)
when %r[nicovideo\.jp]
require 'nicovideo'
Nicovideo.new(params, options)
when %r[^https://freshlive\.tv/]
require 'freshlive'
FreshLive.new(params, options)
else
raise "unsupported url: #{params['url']}"
end
end
|
Instance Method Details
#download ⇒ Object
42
43
44
|
# File 'lib/webradio.rb', line 42
def download
raise 'not implemented.'
end
|
#dump ⇒ Object
46
47
48
|
# File 'lib/webradio.rb', line 46
def dump
raise 'not implemented.'
end
|