splattael-shoutcast_api 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Manifest +0 -2
- data/Rakefile +1 -1
- data/bin/shoutcast_search +9 -0
- data/lib/shoutcast_api.rb +14 -6
- data/shoutcast_api.gemspec +4 -4
- metadata +1 -5
- data/lib/delegator.rb +0 -36
- data/test/test_delegator.rb +0 -27
data/Manifest
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
Rakefile
|
|
2
2
|
bin/shoutcast_search
|
|
3
|
-
lib/delegator.rb
|
|
4
3
|
lib/shoutcast_api.rb
|
|
5
4
|
README.rdoc
|
|
6
5
|
Manifest
|
|
@@ -11,5 +10,4 @@ test/fixtures/genrelist.plain
|
|
|
11
10
|
test/fixtures/search_death.plain
|
|
12
11
|
test/fixtures/empty.plain
|
|
13
12
|
test/test_basic.rb
|
|
14
|
-
test/test_delegator.rb
|
|
15
13
|
shoutcast_api.gemspec
|
data/Rakefile
CHANGED
data/bin/shoutcast_search
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env ruby
|
|
2
2
|
|
|
3
|
+
# Command line interface for shoutcast.com API.
|
|
4
|
+
# See documentation of Shoutcast for more information.
|
|
5
|
+
#
|
|
6
|
+
# === Usage
|
|
7
|
+
#
|
|
8
|
+
# shoutcast_search # => lists all genres
|
|
9
|
+
#
|
|
10
|
+
# shoutcast_search name=Chronix br=128 # => display a list of all Chronix stations with bitrate of 128
|
|
11
|
+
#
|
|
3
12
|
require 'rubygems'
|
|
4
13
|
|
|
5
14
|
require 'shoutcast_api'
|
data/lib/shoutcast_api.rb
CHANGED
|
@@ -2,12 +2,20 @@ require 'httparty'
|
|
|
2
2
|
require 'roxml'
|
|
3
3
|
require 'forwardable'
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
#
|
|
6
|
+
# Simple API for http://shoutcast.com.
|
|
7
|
+
#
|
|
8
|
+
# === Usage
|
|
9
|
+
#
|
|
10
|
+
# Shoutcast.genres # => Genrelist
|
|
11
|
+
#
|
|
12
|
+
# Shoutcast.search(:search => "Metal", :br => 128) # => Stationlist
|
|
7
13
|
module Shoutcast
|
|
14
|
+
|
|
8
15
|
extend Forwardable
|
|
9
16
|
extend self
|
|
10
17
|
|
|
18
|
+
# Delegate module methods to +Fetcher+.
|
|
11
19
|
def_delegators :Fetcher, :genres, :search
|
|
12
20
|
|
|
13
21
|
class Fetcher
|
|
@@ -93,9 +101,9 @@ module Shoutcast
|
|
|
93
101
|
|
|
94
102
|
class Stationlist
|
|
95
103
|
include Xml
|
|
96
|
-
|
|
104
|
+
extend Forwardable
|
|
97
105
|
|
|
98
|
-
|
|
106
|
+
def_delegators :@stations, *(Array.instance_methods - instance_methods)
|
|
99
107
|
|
|
100
108
|
# <tunein base="/sbin/tunein-station.pls"/>
|
|
101
109
|
# <station... /> <station .../>
|
|
@@ -131,9 +139,9 @@ module Shoutcast
|
|
|
131
139
|
|
|
132
140
|
class Genrelist
|
|
133
141
|
include Xml
|
|
134
|
-
|
|
142
|
+
extend Forwardable
|
|
135
143
|
|
|
136
|
-
|
|
144
|
+
def_delegators :@genres, *(Array.instance_methods - instance_methods)
|
|
137
145
|
|
|
138
146
|
xml_attr :genres, :as => [ Genre ]
|
|
139
147
|
|
data/shoutcast_api.gemspec
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Gem::Specification.new do |s|
|
|
4
4
|
s.name = %q{shoutcast_api}
|
|
5
|
-
s.version = "0.1.
|
|
5
|
+
s.version = "0.1.1"
|
|
6
6
|
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
|
8
8
|
s.authors = ["Peter Suschlik"]
|
|
@@ -11,8 +11,8 @@ Gem::Specification.new do |s|
|
|
|
11
11
|
s.description = %q{Simple Shoutcast.com API.}
|
|
12
12
|
s.email = %q{peter-scapi@suschlik.de}
|
|
13
13
|
s.executables = ["shoutcast_search"]
|
|
14
|
-
s.extra_rdoc_files = ["bin/shoutcast_search", "lib/
|
|
15
|
-
s.files = ["Rakefile", "bin/shoutcast_search", "lib/
|
|
14
|
+
s.extra_rdoc_files = ["bin/shoutcast_search", "lib/shoutcast_api.rb", "README.rdoc"]
|
|
15
|
+
s.files = ["Rakefile", "bin/shoutcast_search", "lib/shoutcast_api.rb", "README.rdoc", "Manifest", "test/test_xml.rb", "test/helper.rb", "test/test_fetcher.rb", "test/fixtures/genrelist.plain", "test/fixtures/search_death.plain", "test/fixtures/empty.plain", "test/test_basic.rb", "shoutcast_api.gemspec"]
|
|
16
16
|
s.has_rdoc = true
|
|
17
17
|
s.homepage = %q{http://github.com/splattael/shoutcast_api}
|
|
18
18
|
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Shoutcast_api", "--main", "README.rdoc"]
|
|
@@ -20,7 +20,7 @@ Gem::Specification.new do |s|
|
|
|
20
20
|
s.rubyforge_project = %q{shoutcast_api}
|
|
21
21
|
s.rubygems_version = %q{1.3.1}
|
|
22
22
|
s.summary = %q{Simple Shoutcast.com API.}
|
|
23
|
-
s.test_files = ["test/test_xml.rb", "test/test_fetcher.rb", "test/test_basic.rb"
|
|
23
|
+
s.test_files = ["test/test_xml.rb", "test/test_fetcher.rb", "test/test_basic.rb"]
|
|
24
24
|
|
|
25
25
|
if s.respond_to? :specification_version then
|
|
26
26
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: splattael-shoutcast_api
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Peter Suschlik
|
|
@@ -40,13 +40,11 @@ extensions: []
|
|
|
40
40
|
|
|
41
41
|
extra_rdoc_files:
|
|
42
42
|
- bin/shoutcast_search
|
|
43
|
-
- lib/delegator.rb
|
|
44
43
|
- lib/shoutcast_api.rb
|
|
45
44
|
- README.rdoc
|
|
46
45
|
files:
|
|
47
46
|
- Rakefile
|
|
48
47
|
- bin/shoutcast_search
|
|
49
|
-
- lib/delegator.rb
|
|
50
48
|
- lib/shoutcast_api.rb
|
|
51
49
|
- README.rdoc
|
|
52
50
|
- Manifest
|
|
@@ -57,7 +55,6 @@ files:
|
|
|
57
55
|
- test/fixtures/search_death.plain
|
|
58
56
|
- test/fixtures/empty.plain
|
|
59
57
|
- test/test_basic.rb
|
|
60
|
-
- test/test_delegator.rb
|
|
61
58
|
- shoutcast_api.gemspec
|
|
62
59
|
has_rdoc: true
|
|
63
60
|
homepage: http://github.com/splattael/shoutcast_api
|
|
@@ -94,4 +91,3 @@ test_files:
|
|
|
94
91
|
- test/test_xml.rb
|
|
95
92
|
- test/test_fetcher.rb
|
|
96
93
|
- test/test_basic.rb
|
|
97
|
-
- test/test_delegator.rb
|
data/lib/delegator.rb
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
module Shoutcast
|
|
2
|
-
|
|
3
|
-
# Delegates methods via Forwardable.
|
|
4
|
-
module Delegator
|
|
5
|
-
def self.included(base)
|
|
6
|
-
base.extend ClassMethods
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
module ClassMethods
|
|
10
|
-
# Delegates all methods defined +klass+ to +object+.
|
|
11
|
-
#
|
|
12
|
-
# === Usage
|
|
13
|
-
# class ArrayMimic < SomeInheritance
|
|
14
|
-
#
|
|
15
|
-
# delegate_all :@array, Array
|
|
16
|
-
#
|
|
17
|
-
# end
|
|
18
|
-
#
|
|
19
|
-
# array = ArrayMimic.new
|
|
20
|
-
# array.push 1, 2, 3
|
|
21
|
-
# array.each do |item|
|
|
22
|
-
# p item
|
|
23
|
-
# end
|
|
24
|
-
#
|
|
25
|
-
def delegate_all(object, klass)
|
|
26
|
-
class_eval <<-EVAL
|
|
27
|
-
extend Forwardable
|
|
28
|
-
|
|
29
|
-
def_delegators :#{object}, *(#{klass}.instance_methods - instance_methods)
|
|
30
|
-
EVAL
|
|
31
|
-
end
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
end
|
data/test/test_delegator.rb
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
require File.join(File.dirname(__FILE__), 'helper')
|
|
2
|
-
|
|
3
|
-
class ArrayMimic
|
|
4
|
-
include Shoutcast::Delegator
|
|
5
|
-
|
|
6
|
-
delegate_all :@array, Array
|
|
7
|
-
|
|
8
|
-
def initialize
|
|
9
|
-
@array = []
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
class DelegatorTest < Test::Unit::TestCase
|
|
15
|
-
|
|
16
|
-
def test_method_delegation
|
|
17
|
-
ary = ArrayMimic.new
|
|
18
|
-
ary.push 1, 2, 3
|
|
19
|
-
|
|
20
|
-
assert_equal 3, ary.size
|
|
21
|
-
assert_equal 1, ary.first
|
|
22
|
-
assert_equal 3, ary.last
|
|
23
|
-
assert_respond_to ary, :each
|
|
24
|
-
assert_equal [].methods.sort, ary.methods.sort
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
end
|