Class: Soma

Inherits:
Site show all
Defined in:
lib/terminal_player/soma.rb

Instance Attribute Summary

Attributes inherited from Site

#channels, #current_channel, #is_di_plus, #is_mplayer, #is_spotify, #name, #player, #songs

Instance Method Summary collapse

Methods inherited from Site

#play, #song_changed

Constructor Details

#initialize(options) ⇒ Soma

Returns a new instance of Soma.



2
3
4
# File 'lib/terminal_player/soma.rb', line 2

def initialize(options)
  super(options, "soma")
end

Instance Method Details

#get_channelsObject



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