Révision 17f78427
Whitespace cleanup
- remove trailing whitespace
- remove empty lines at the end of files
| plugins/icecast/icecast2_simple | ||
|---|---|---|
| 1 | 1 |
#!/usr/bin/env ruby |
| 2 | 2 |
# |
| 3 | 3 |
# Plugin author: Gunnar Wolf <gwolf@gwolf.org> |
| 4 |
#
|
|
| 4 |
# |
|
| 5 | 5 |
# You are hereby granted authorization to copy, use, modify, distribute, |
| 6 | 6 |
# and in general do anything you please with this plugin. It is too simple |
| 7 | 7 |
# even to GPL-protect it. |
| ... | ... | |
| 18 | 18 |
|
| 19 | 19 |
def get_conf |
| 20 | 20 |
# Default values |
| 21 |
conf = {:host => '127.0.0.1', :port => 8000,
|
|
| 21 |
conf = {:host => '127.0.0.1', :port => 8000,
|
|
| 22 | 22 |
:username => 'admin', :password => 'hackme' } |
| 23 | 23 |
conf.keys.each do |key| |
| 24 | 24 |
env_key = sprintf('icecast_%s', key)
|
| ... | ... | |
| 28 | 28 |
end |
| 29 | 29 |
|
| 30 | 30 |
def get_data(conf) |
| 31 |
begin
|
|
| 32 |
data = Hpricot(open(sprintf('http://%s:%s/admin/stats',
|
|
| 31 |
begin |
|
| 32 |
data = Hpricot(open(sprintf('http://%s:%s/admin/stats',
|
|
| 33 | 33 |
conf[:host], conf[:port]), |
| 34 |
:http_basic_authentication=>[conf[:username],
|
|
| 34 |
:http_basic_authentication=>[conf[:username], |
|
| 35 | 35 |
conf[:password]])) |
| 36 | 36 |
rescue OpenURI::HTTPError |
| 37 | 37 |
puts "Cannot connect: HTTP connection error" |
Formats disponibles : Unified diff