Class: Metalive::Icecast
- Inherits:
-
Object
- Object
- Metalive::Icecast
- Includes:
- HTTParty
- Defined in:
- lib/metalive/icecast.rb
Instance Attribute Summary collapse
-
#mount ⇒ Object
Returns the value of attribute mount.
-
#password ⇒ Object
Returns the value of attribute password.
-
#port ⇒ Object
Returns the value of attribute port.
-
#server ⇒ Object
Returns the value of attribute server.
-
#username ⇒ Object
Returns the value of attribute username.
Instance Method Summary collapse
- #authentication ⇒ Object
- #base_uri ⇒ Object
-
#initialize(options = {}) ⇒ Icecast
constructor
A new instance of Icecast.
- #path ⇒ Object
- #query(song) ⇒ Object
- #update(metadata) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Icecast
Returns a new instance of Icecast.
8 9 10 11 |
# File 'lib/metalive/icecast.rb', line 8 def initialize( = {}) = { :username => "source", :port => 8000 }.update() .each_pair { |k,v| send("#{k}=", v) } end |
Instance Attribute Details
#mount ⇒ Object
Returns the value of attribute mount.
6 7 8 |
# File 'lib/metalive/icecast.rb', line 6 def mount @mount end |
#password ⇒ Object
Returns the value of attribute password.
6 7 8 |
# File 'lib/metalive/icecast.rb', line 6 def password @password end |
#port ⇒ Object
Returns the value of attribute port.
6 7 8 |
# File 'lib/metalive/icecast.rb', line 6 def port @port end |
#server ⇒ Object
Returns the value of attribute server.
6 7 8 |
# File 'lib/metalive/icecast.rb', line 6 def server @server end |
#username ⇒ Object
Returns the value of attribute username.
6 7 8 |
# File 'lib/metalive/icecast.rb', line 6 def username @username end |
Instance Method Details
#authentication ⇒ Object
13 14 15 |
# File 'lib/metalive/icecast.rb', line 13 def authentication { :username => username, :password => password } end |
#base_uri ⇒ Object
25 26 27 |
# File 'lib/metalive/icecast.rb', line 25 def base_uri "http://#{server}:#{port}" end |
#path ⇒ Object
29 30 31 |
# File 'lib/metalive/icecast.rb', line 29 def path "/admin/metadata" end |
#query(song) ⇒ Object
17 18 19 |
# File 'lib/metalive/icecast.rb', line 17 def query(song) { :mount => mount, :mode => "updinfo", :song => song } end |
#update(metadata) ⇒ Object
33 34 35 36 37 38 39 |
# File 'lib/metalive/icecast.rb', line 33 def update() song = (Hash === ? [:song] : .to_s) self.class.get path, :base_uri => base_uri, :basic_auth => authentication, :query => query(song) true rescue => e false end |