Class: ListenRadio
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from Radio
#area_en, #area_id, #area_ja, #ext, #outdir
Instance Method Summary collapse
-
#initialize ⇒ ListenRadio
constructor
A new instance of ListenRadio.
- #parse_stations(body) ⇒ Object
- #stations_uri ⇒ Object
Methods inherited from Radio
#agent, bands, #channel_to_uri, channels, #close, #convert, #convert_ffmpeg, #create_player, #datetime, db, #fetch_stations, find, inherited, #login, #make_recfile, #make_tmpfile, match, #open, #out_ext, #play, #record, search, stations, #tune
Constructor Details
#initialize ⇒ ListenRadio
Returns a new instance of ListenRadio.
13 14 15 16 |
# File 'lib/rbtune/listenradio.rb', line 13 def initialize super @ext = 'mp4' end |
Instance Method Details
#parse_stations(body) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/rbtune/listenradio.rb', line 24 def parse_stations(body) json = JSON[body.body, symbolize_names: true] stations = json[:Channel].map do |station| name = station[:ChannelName] id = station[:ChannelId] desc = station[:ChannelDetail] uri = station[:ChannelHls] # puts "'#{name}' <#{uri}> #{desc}" Station.new(id, uri, name: name, description: desc) end end |
#stations_uri ⇒ Object
19 20 21 |
# File 'lib/rbtune/listenradio.rb', line 19 def stations_uri 'http://listenradio.jp/service/channel.aspx' end |