Class: Soma
Instance Attribute Summary
Attributes inherited from Site
#channels, #current_channel, #is_di_plus, #is_mplayer, #is_spotify, #name, #player, #songs
Instance Method Summary collapse
- #get_channels ⇒ Object
-
#initialize(options) ⇒ Soma
constructor
A new instance of Soma.
Methods inherited from Site
Constructor Details
#initialize(options) ⇒ Soma
Returns a new instance of Soma.
2 3 4 |
# File 'lib/terminal_player/soma.rb', line 2 def initialize() super(, "soma") end |
Instance Method Details
#get_channels ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/terminal_player/soma.rb', line 6 def get_channels @channels = [] f = open('http://somafm.com/listen') page = f.read chans = page.scan(/\/play\/(.*?)"/).flatten chans.each do |c| next if c['fw/'] @channels << {id: 0, name: c} end @channels.sort_by! {|k, _| k[:name]} @channels.uniq! {|k, _| k[:name]} end |