class Soma

Public Class Methods

new(options) click to toggle source
Calls superclass method Site::new
# File lib/terminal_player/soma.rb, line 2
def initialize(options)
  super(options, "soma")
end

Public Instance Methods

get_channels() click to toggle source
# 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