Class: TimeFree
- Inherits:
-
RadikoPremium
- Object
- Radio
- Radiko
- RadikoPremium
- TimeFree
- Defined in:
- lib/rbtune/timefree.rb
Instance Attribute Summary
Attributes inherited from Radiko
Attributes inherited from Radio
#area_en, #area_id, #area_ja, #ext, #outdir
Class Method Summary collapse
Instance Method Summary collapse
- #channel_to_uri(from, to) ⇒ Object
- #create_player(uri) ⇒ Object
- #record(filename, starttime, sec) ⇒ Object
Methods inherited from RadikoPremium
#close, #headers, #login, set_authentication, #stations_uri
Methods inherited from Radiko
#authenticate1, #authenticate2, #open, #parse_stations, #read_partialkey, #stations_uri
Methods inherited from Radio
#agent, bands, channels, #close, #convert, #convert_ffmpeg, #datetime, db, #fetch_stations, find, inherited, #initialize, #login, #make_recfile, #make_tmpfile, match, #open, #out_ext, #play, search, #tune
Constructor Details
This class inherits a constructor from Radio
Class Method Details
.stations ⇒ Object
12 13 14 |
# File 'lib/rbtune/timefree.rb', line 12 def self.stations [] end |
Instance Method Details
#channel_to_uri(from, to) ⇒ Object
35 36 37 |
# File 'lib/rbtune/timefree.rb', line 35 def channel_to_uri(from, to) %Q(https://radiko.jp/v2/api/ts/playlist.m3u8?l=15&station_id=#{@channel}&ft=#{from}&to=#{to}) end |
#create_player(uri) ⇒ Object
40 41 42 43 44 |
# File 'lib/rbtune/timefree.rb', line 40 def create_player(uri) player = super player['acodec'] = 'copy' player end |
#record(filename, starttime, sec) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/rbtune/timefree.rb', line 16 def record(filename, starttime, sec) endtime = starttime + sec/60/60/24 from = starttime.timefree to = endtime.timefree # pp [@channel, from, to] uri = channel_to_uri from, to player = create_player uri dt = datetime starttime recfile = make_recfile filename, dt stdout, stderr, status = player.rec recfile, nil case stderr when /400 Bad Request/ raise HTTPBadRequestException when /403 Forbidden/ raise HTTPForbiddenException end end |