Sha256: 7d8a5c9cf5ca01c9ee0058544b801ee35de3897c11757a94df1e419c6b99634c
Contents?: true
Size: 846 Bytes
Versions: 2
Compression:
Stored size: 846 Bytes
Contents
require 'httparty' class Metalive::Icecast include HTTParty attr_accessor :server, :port, :mount, :username, :password def initialize(options = {}) options = { :username => "source", :port => 8000 }.update(options) options.each_pair { |k,v| send("#{k}=", v) } end def authentication { :username => username, :password => password } end def query(song) { :mount => mount, :mode => "updinfo", :song => song } end def mount @mount.start_with?("/") ? @mount : "/#{@mount}" end def base_uri "http://#{server}:#{port}" end def path "/admin/metadata" end def update(metadata) song = (Hash === metadata ? metadata[:song] : metadata.to_s) self.class.get path, :base_uri => base_uri, :basic_auth => authentication, :query => query(song) true rescue => e false end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
metalive-0.0.2 | lib/metalive/icecast.rb |
metalive-0.0.1 | lib/metalive/icecast.rb |