Class: Mpg123Remote::Player

Inherits:
Object
  • Object
show all
Defined in:
lib/mpg123_remote.rb

Instance Method Summary collapse

Constructor Details

#initialize(path = '/tmp/mpg123in') ⇒ Player

Returns a new instance of Player.



4
5
6
# File 'lib/mpg123_remote.rb', line 4

def initialize path='/tmp/mpg123in'
  @path = path
end

Instance Method Details

#execute(*args) ⇒ Object



17
18
19
20
21
# File 'lib/mpg123_remote.rb', line 17

def execute *args
  File.open(@path, 'w') do |f|
    f.puts args.join ' '
  end
end

#play(path) ⇒ Object



13
14
15
# File 'lib/mpg123_remote.rb', line 13

def play path
  execute "LOAD #{Dir.pwd}/#{path}"
end

#somafm(station) ⇒ Object



8
9
10
11
# File 'lib/mpg123_remote.rb', line 8

def somafm station
  station ||= 'secretagent'
  execute 'loadlist', 0, "http://somafm.com/startstream=#{station}.pls"
end