ruby-shout 2.1 → 2.2.0.pre2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.textile +84 -0
- data/Rakefile +29 -0
- data/VERSION +1 -0
- data/ext/shout.c +20 -14
- data/test/integration-test.rb +90 -0
- metadata +60 -35
- data/README +0 -52
- data/example.rb +0 -34
data/README.textile
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
h1. Ruby-Shout
|
2
|
+
|
3
|
+
h2. Purpose
|
4
|
+
|
5
|
+
ruby-shout lets you send compressed audio over the network to an "Icecast":http://www.icecast.org/ streaming media server.
|
6
|
+
|
7
|
+
h2. Requirements
|
8
|
+
|
9
|
+
libshout 2.0, available from "icecast.org":http://www.icecast.org/download.php. libshout 2 requires the ogg and vorbis libraries.
|
10
|
+
|
11
|
+
h2. Summary of usage
|
12
|
+
|
13
|
+
This extension follows python-shout fairly closely. You make a Shout object with Shout.new, set its properties, tell it to connect, then send blocks of data, sync and repeat. Disconnect when done.
|
14
|
+
|
15
|
+
h2. Usage
|
16
|
+
|
17
|
+
See example.rb. Run it like
|
18
|
+
|
19
|
+
./example.rb test/test.mp3
|
20
|
+
|
21
|
+
h2. Todo
|
22
|
+
|
23
|
+
* proper unit tests (blush)
|
24
|
+
|
25
|
+
h2. History & Credits
|
26
|
+
|
27
|
+
* 2001 Jared Jenning built the initial version for libshout 1
|
28
|
+
* 2003 Jared Jenning rebuilt ruby-shout for libshout 2 and maintained it to until 2005
|
29
|
+
* Yauhen Kharuzhy helped with bugfixes and initial metadata support
|
30
|
+
* 2010 "Overlay" (real name unknown to me) patched ruby-shout for ruby 1.9 support, Diego Elio "Flameeyes" Pettenò "incorporated patch into the gentoo package":http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/dev-ruby/ruby-shout/files/ruby-shout-2.1%2Bruby-1.9.patch?revision=1.1&view=markup. It got removed later on due to "some issues":http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/dev-ruby/ruby-shout/files/ruby-shout-2.1%2Bruby-1.9.patch?view=markup.
|
31
|
+
* 2010 Niko Dittman re-added the patch and fixed the issues. See "Recent Changes" for details.
|
32
|
+
|
33
|
+
h2. Recent Changes
|
34
|
+
|
35
|
+
* Included the "ruby 1.9 patch":http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/dev-ruby/ruby-shout/files/ruby-shout-2.1%2Bruby-1.9.patch?revision=1.1&view=markup although it seems to have "some issues":http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/dev-ruby/ruby-shout/files/ruby-shout-2.1%2Bruby-1.9.patch?view=log. I hope to have fixed the issues with this:
|
36
|
+
* Replaced STR2CSTR for StringValuePtr as STR2CSTR doesn't work for 1.9 any more
|
37
|
+
* Added format = Shout::MP3 to the example as this is absolutely needed by the latest versions of libshout.
|
38
|
+
* Added an integration test which builds and installs the gem and plays some sound on a local icecast server. I mainly did that because the old version of ruby-shout didn't even compile for ruby 1.9. Run with:
|
39
|
+
|
40
|
+
rake test:integration
|
41
|
+
|
42
|
+
h2. State
|
43
|
+
|
44
|
+
I tested this version of ruby-shout to build and run on
|
45
|
+
|
46
|
+
* ruby-1.8.7-p174 [x86_64] OSX 10.6
|
47
|
+
* ruby-1.9.1-p378 [x86_64] OSX 10.6
|
48
|
+
* ruby-1.9.2-rc1 [x86_64] OSX 10.6
|
49
|
+
* ruby-1.9.2-p0 [x86_64] OSX 10.6
|
50
|
+
* ruby-1.8.7-p299 [i386] ubuntu 2.6.32
|
51
|
+
* ruby-1.9.2-rc2 [i386] ubuntu 2.6.32
|
52
|
+
|
53
|
+
h2. License
|
54
|
+
This is a BSD license.
|
55
|
+
|
56
|
+
Copyright (c) 2003-2005, Jared Jennings
|
57
|
+
Copyright (c) 2010, Niko Dittmann
|
58
|
+
|
59
|
+
All rights reserved.
|
60
|
+
|
61
|
+
Redistribution and use in source and binary forms, with or without
|
62
|
+
modification, are permitted provided that the following conditions are met:
|
63
|
+
|
64
|
+
* Redistributions of source code must retain the above copyright notice, this
|
65
|
+
list of conditions and the following disclaimer.
|
66
|
+
|
67
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
68
|
+
this list of conditions and the following disclaimer in the documentation
|
69
|
+
and/or other materials provided with the distribution.
|
70
|
+
|
71
|
+
* Neither the names of the authors nor the names of contributors may
|
72
|
+
be used to endorse or promote products derived from this software without
|
73
|
+
specific prior written permission.
|
74
|
+
|
75
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
76
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
77
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
78
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
79
|
+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
80
|
+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
81
|
+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
82
|
+
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
83
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
84
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
data/Rakefile
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake/gempackagetask'
|
3
|
+
|
4
|
+
task :default => [:test]
|
5
|
+
|
6
|
+
namespace :test do
|
7
|
+
desc "run the build integration test"
|
8
|
+
task :integration do
|
9
|
+
ruby "test/integration-test.rb"
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
begin
|
14
|
+
require 'jeweler'
|
15
|
+
Jeweler::Tasks.new do |s|
|
16
|
+
s.name = "ruby-shout"
|
17
|
+
s.summary = "Send audio over the network to an Icecast server"
|
18
|
+
s.description = %q{Ruby bindings for libshout 2, a "Library which can be used to write a source client like ices" for Icecast (http://www.icecast.org/download.php).}
|
19
|
+
s.email = "mail@niko-dittmann.com"
|
20
|
+
s.homepage = "http://github.com/niko/ruby-shout"
|
21
|
+
s.authors = ["Jared Jennings", "Niko Dittmann"]
|
22
|
+
s.require_paths = ["lib"]
|
23
|
+
s.rubyforge_project = 'ruby-shout'
|
24
|
+
s.files = FileList["[A-Z]*", "{ext}/*"]
|
25
|
+
|
26
|
+
end
|
27
|
+
rescue LoadError
|
28
|
+
puts "Jeweler not available. Install it with: gem install jeweler"
|
29
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.2.0.pre2
|
data/ext/shout.c
CHANGED
@@ -5,6 +5,7 @@
|
|
5
5
|
redone for libshout2 18 jul 2003
|
6
6
|
|
7
7
|
Copyright (c) 2003-2005, Jared Jennings
|
8
|
+
Copyright (c) 2010 Niko Dittmann
|
8
9
|
All rights reserved.
|
9
10
|
|
10
11
|
Redistribution and use in source and binary forms, with or without
|
@@ -17,7 +18,7 @@
|
|
17
18
|
this list of conditions and the following disclaimer in the documentation
|
18
19
|
and/or other materials provided with the distribution.
|
19
20
|
|
20
|
-
* Neither the
|
21
|
+
* Neither the names of the authors nor the names of contributors may
|
21
22
|
be used to endorse or promote products derived from this software without
|
22
23
|
specific prior written permission.
|
23
24
|
|
@@ -40,6 +41,11 @@
|
|
40
41
|
|
41
42
|
#define DEFAULT_MOUNTPOINT "/default"
|
42
43
|
|
44
|
+
#ifndef RSTRING_LEN
|
45
|
+
#define RSTRING_LEN(str) RSTRING(str)->len
|
46
|
+
#define RSTRING_PTR(str) RSTRING(str)->ptr
|
47
|
+
#endif
|
48
|
+
|
43
49
|
/*
|
44
50
|
----------------- ShoutError --------------------
|
45
51
|
*/
|
@@ -108,7 +114,7 @@ static VALUE _sh_metadata_add(VALUE self, VALUE name, VALUE value) {
|
|
108
114
|
int err;
|
109
115
|
|
110
116
|
Data_Get_Struct(self, shout_metadata_t, m);
|
111
|
-
err = shout_metadata_add(m,
|
117
|
+
err = shout_metadata_add(m, StringValuePtr(name), StringValuePtr(value));
|
112
118
|
|
113
119
|
if(err != SHOUTERR_SUCCESS) {
|
114
120
|
raise_nonspecific_shout_error(err);
|
@@ -233,8 +239,8 @@ static VALUE _sh_send(VALUE self, VALUE to_send) {
|
|
233
239
|
GET_SC(self, s);
|
234
240
|
|
235
241
|
Check_SafeStr(to_send);
|
236
|
-
err = shout_send(s->conn, (unsigned char *) (
|
237
|
-
|
242
|
+
err = shout_send(s->conn, (unsigned char *) (RSTRING_PTR(to_send)),
|
243
|
+
RSTRING_LEN(to_send));
|
238
244
|
if(err != SHOUTERR_SUCCESS) {
|
239
245
|
raise_shout_error(s->conn);
|
240
246
|
}
|
@@ -409,7 +415,7 @@ VALUE _sh_host_eq(VALUE self, VALUE value) {
|
|
409
415
|
shout_connection *s; GET_SC(self, s);
|
410
416
|
|
411
417
|
Check_Type(value, T_STRING);
|
412
|
-
err = shout_set_host(s->conn,
|
418
|
+
err = shout_set_host(s->conn, RSTRING_PTR(value));
|
413
419
|
if(err != SHOUTERR_SUCCESS) {
|
414
420
|
raise_shout_error(s->conn);
|
415
421
|
}
|
@@ -435,7 +441,7 @@ VALUE _sh_user_eq(VALUE self, VALUE value) {
|
|
435
441
|
shout_connection *s; GET_SC(self, s);
|
436
442
|
|
437
443
|
Check_Type(value, T_STRING);
|
438
|
-
err = shout_set_user(s->conn,
|
444
|
+
err = shout_set_user(s->conn, RSTRING_PTR(value));
|
439
445
|
if(err != SHOUTERR_SUCCESS) {
|
440
446
|
raise_shout_error(s->conn);
|
441
447
|
}
|
@@ -448,7 +454,7 @@ VALUE _sh_pass_eq(VALUE self, VALUE value) {
|
|
448
454
|
shout_connection *s; GET_SC(self, s);
|
449
455
|
|
450
456
|
Check_Type(value, T_STRING);
|
451
|
-
err = shout_set_password(s->conn,
|
457
|
+
err = shout_set_password(s->conn, RSTRING_PTR(value));
|
452
458
|
if(err != SHOUTERR_SUCCESS) {
|
453
459
|
raise_shout_error(s->conn);
|
454
460
|
}
|
@@ -495,7 +501,7 @@ VALUE _sh_mount_eq(VALUE self, VALUE value) {
|
|
495
501
|
shout_connection *s; GET_SC(self, s);
|
496
502
|
|
497
503
|
Check_Type(value, T_STRING);
|
498
|
-
err = shout_set_mount(s->conn,
|
504
|
+
err = shout_set_mount(s->conn, RSTRING_PTR(value));
|
499
505
|
if(err != SHOUTERR_SUCCESS) {
|
500
506
|
raise_shout_error(s->conn);
|
501
507
|
}
|
@@ -509,7 +515,7 @@ VALUE _sh_dumpfile_eq(VALUE self, VALUE value) {
|
|
509
515
|
shout_connection *s; GET_SC(self, s);
|
510
516
|
|
511
517
|
Check_Type(value, T_STRING);
|
512
|
-
err = shout_set_dumpfile(s->conn,
|
518
|
+
err = shout_set_dumpfile(s->conn, RSTRING_PTR(value));
|
513
519
|
if(err != SHOUTERR_SUCCESS) {
|
514
520
|
raise_shout_error(s->conn);
|
515
521
|
}
|
@@ -523,7 +529,7 @@ VALUE _sh_agent_eq(VALUE self, VALUE value) {
|
|
523
529
|
shout_connection *s; GET_SC(self, s);
|
524
530
|
|
525
531
|
Check_Type(value, T_STRING);
|
526
|
-
err = shout_set_agent(s->conn,
|
532
|
+
err = shout_set_agent(s->conn, RSTRING_PTR(value));
|
527
533
|
if(err != SHOUTERR_SUCCESS) {
|
528
534
|
raise_shout_error(s->conn);
|
529
535
|
}
|
@@ -554,7 +560,7 @@ VALUE _sh_name_eq(VALUE self, VALUE value) {
|
|
554
560
|
shout_connection *s; GET_SC(self, s);
|
555
561
|
|
556
562
|
Check_Type(value, T_STRING);
|
557
|
-
err = shout_set_name(s->conn,
|
563
|
+
err = shout_set_name(s->conn, RSTRING_PTR(value));
|
558
564
|
if(err != SHOUTERR_SUCCESS) {
|
559
565
|
raise_shout_error(s->conn);
|
560
566
|
}
|
@@ -567,7 +573,7 @@ VALUE _sh_url_eq(VALUE self, VALUE value) {
|
|
567
573
|
shout_connection *s; GET_SC(self, s);
|
568
574
|
|
569
575
|
Check_Type(value, T_STRING);
|
570
|
-
err = shout_set_url(s->conn,
|
576
|
+
err = shout_set_url(s->conn, RSTRING_PTR(value));
|
571
577
|
if(err != SHOUTERR_SUCCESS) {
|
572
578
|
raise_shout_error(s->conn);
|
573
579
|
}
|
@@ -580,7 +586,7 @@ VALUE _sh_genre_eq(VALUE self, VALUE value) {
|
|
580
586
|
shout_connection *s; GET_SC(self, s);
|
581
587
|
|
582
588
|
Check_Type(value, T_STRING);
|
583
|
-
err = shout_set_genre(s->conn,
|
589
|
+
err = shout_set_genre(s->conn, RSTRING_PTR(value));
|
584
590
|
if(err != SHOUTERR_SUCCESS) {
|
585
591
|
raise_shout_error(s->conn);
|
586
592
|
}
|
@@ -593,7 +599,7 @@ VALUE _sh_description_eq(VALUE self, VALUE value) {
|
|
593
599
|
shout_connection *s; GET_SC(self, s);
|
594
600
|
|
595
601
|
Check_Type(value, T_STRING);
|
596
|
-
err = shout_set_description(s->conn,
|
602
|
+
err = shout_set_description(s->conn, RSTRING_PTR(value));
|
597
603
|
if(err != SHOUTERR_SUCCESS) {
|
598
604
|
raise_shout_error(s->conn);
|
599
605
|
}
|
@@ -0,0 +1,90 @@
|
|
1
|
+
# This test builds the gem (there where build errors on 1.9 without the patch),
|
2
|
+
# installs it and starts a station on mountpoint /test.
|
3
|
+
# You should have an icecast-server listening on 8000 (that's the default)
|
4
|
+
# for incoming source connections.
|
5
|
+
# Point your radio client to http://localhost:8000/test.
|
6
|
+
# Look for the metadata being correctly set ('gromozek - melange').
|
7
|
+
|
8
|
+
# test.mp3 is 'melange' by 'gromozek' http://ccmixter.org/files/gromozek/20114
|
9
|
+
# licensed CC Attribution Noncommercial (3.0) http://creativecommons.org/licenses/by-nc/3.0/
|
10
|
+
|
11
|
+
def base_dir
|
12
|
+
File.expand_path File.join(File.dirname(__FILE__), '..')
|
13
|
+
end
|
14
|
+
|
15
|
+
def version
|
16
|
+
File.open(File.join(base_dir, 'VERSION')).readline.strip
|
17
|
+
end
|
18
|
+
|
19
|
+
def remove_pkg
|
20
|
+
puts '=> removing pkg/'
|
21
|
+
command = %Q{
|
22
|
+
cd #{base_dir}
|
23
|
+
rm -rf pkg
|
24
|
+
}
|
25
|
+
`#{command}`
|
26
|
+
end
|
27
|
+
|
28
|
+
def clean_test_gem
|
29
|
+
puts '=> removing test/test_gem_installation/'
|
30
|
+
command = %Q{
|
31
|
+
cd #{base_dir}
|
32
|
+
rm -rf test/test_gem_installation
|
33
|
+
}
|
34
|
+
`#{command}`
|
35
|
+
end
|
36
|
+
|
37
|
+
def install_gem
|
38
|
+
puts '=> building the gem into pkg/ and installing into test/test_gem_installation/'
|
39
|
+
command = %Q{
|
40
|
+
cd #{base_dir}
|
41
|
+
rake build
|
42
|
+
gem install --no-test --no-rdoc --no-ri --install-dir test/test_gem_installation --bindir test/test_gem_installation pkg/ruby-shout-#{version}.gem
|
43
|
+
}
|
44
|
+
`#{command}`
|
45
|
+
end
|
46
|
+
|
47
|
+
clean_test_gem
|
48
|
+
install_gem
|
49
|
+
remove_pkg
|
50
|
+
|
51
|
+
$LOAD_PATH.clear
|
52
|
+
$LOAD_PATH << File.join(base_dir, "test/test_gem_installation/gems/ruby-shout-#{version}/lib")
|
53
|
+
require 'shout'
|
54
|
+
|
55
|
+
def test_all
|
56
|
+
blocksize = 16384
|
57
|
+
|
58
|
+
s = Shout.new
|
59
|
+
s.host = "localhost"
|
60
|
+
s.port = 8000
|
61
|
+
s.mount = "/test"
|
62
|
+
s.user = "source"
|
63
|
+
s.pass = "hackme"
|
64
|
+
s.format = Shout::MP3
|
65
|
+
|
66
|
+
s.connect
|
67
|
+
|
68
|
+
filename = File.join(File.dirname(__FILE__), 'test.mp3')
|
69
|
+
|
70
|
+
File.open(filename) do |file|
|
71
|
+
puts "=> sending data from #{filename}...\n go check http://localhost:8000/test"
|
72
|
+
m = ShoutMetadata.new
|
73
|
+
m.add 'filename', filename
|
74
|
+
m.add 'artist', 'gromozek'
|
75
|
+
m.add 'title', 'melange'
|
76
|
+
s.metadata = m
|
77
|
+
|
78
|
+
while data = file.read(blocksize)
|
79
|
+
s.send data
|
80
|
+
print '.'
|
81
|
+
s.sync
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
s.disconnect
|
86
|
+
ensure
|
87
|
+
clean_test_gem
|
88
|
+
end
|
89
|
+
|
90
|
+
test_all
|
metadata
CHANGED
@@ -1,48 +1,73 @@
|
|
1
|
-
!ruby/object:Gem::Specification
|
2
|
-
rubygems_version: 0.8.11
|
3
|
-
specification_version: 1
|
1
|
+
--- !ruby/object:Gem::Specification
|
4
2
|
name: ruby-shout
|
5
3
|
version: !ruby/object:Gem::Version
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
-
|
11
|
-
|
12
|
-
|
13
|
-
rubyforge_project:
|
14
|
-
description:
|
15
|
-
autorequire: shout
|
16
|
-
default_executable:
|
17
|
-
bindir: bin
|
18
|
-
has_rdoc: true
|
19
|
-
required_ruby_version: !ruby/object:Gem::Version::Requirement
|
20
|
-
requirements:
|
21
|
-
- - ">"
|
22
|
-
- !ruby/object:Gem::Version
|
23
|
-
version: 0.0.0
|
24
|
-
version:
|
4
|
+
prerelease: true
|
5
|
+
segments:
|
6
|
+
- 2
|
7
|
+
- 2
|
8
|
+
- 0
|
9
|
+
- pre2
|
10
|
+
version: 2.2.0.pre2
|
25
11
|
platform: ruby
|
26
|
-
signing_key:
|
27
|
-
cert_chain:
|
28
12
|
authors:
|
29
13
|
- Jared Jennings
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
- README
|
35
|
-
test_files: []
|
14
|
+
- Niko Dittmann
|
15
|
+
autorequire:
|
16
|
+
bindir: bin
|
17
|
+
cert_chain: []
|
36
18
|
|
37
|
-
|
19
|
+
date: 2010-09-05 00:00:00 +02:00
|
20
|
+
default_executable:
|
21
|
+
dependencies: []
|
38
22
|
|
39
|
-
|
40
|
-
-
|
23
|
+
description: Ruby bindings for libshout 2, a "Library which can be used to write a source client like ices" for Icecast (http://www.icecast.org/download.php).
|
24
|
+
email: mail@niko-dittmann.com
|
41
25
|
executables: []
|
42
26
|
|
43
27
|
extensions:
|
44
28
|
- ext/extconf.rb
|
45
|
-
|
29
|
+
extra_rdoc_files:
|
30
|
+
- README.textile
|
31
|
+
files:
|
32
|
+
- README.textile
|
33
|
+
- Rakefile
|
34
|
+
- VERSION
|
35
|
+
- ext/extconf.rb
|
36
|
+
- ext/shout.c
|
37
|
+
- test/integration-test.rb
|
38
|
+
has_rdoc: true
|
39
|
+
homepage: http://github.com/niko/ruby-shout
|
40
|
+
licenses: []
|
46
41
|
|
47
|
-
|
42
|
+
post_install_message:
|
43
|
+
rdoc_options:
|
44
|
+
- --charset=UTF-8
|
45
|
+
require_paths:
|
46
|
+
- lib
|
47
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
48
|
+
none: false
|
49
|
+
requirements:
|
50
|
+
- - ">="
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
segments:
|
53
|
+
- 0
|
54
|
+
version: "0"
|
55
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
56
|
+
none: false
|
57
|
+
requirements:
|
58
|
+
- - ">"
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
segments:
|
61
|
+
- 1
|
62
|
+
- 3
|
63
|
+
- 1
|
64
|
+
version: 1.3.1
|
65
|
+
requirements: []
|
48
66
|
|
67
|
+
rubyforge_project: ruby-shout
|
68
|
+
rubygems_version: 1.3.7
|
69
|
+
signing_key:
|
70
|
+
specification_version: 3
|
71
|
+
summary: Send audio over the network to an Icecast server
|
72
|
+
test_files:
|
73
|
+
- test/integration-test.rb
|
data/README
DELETED
@@ -1,52 +0,0 @@
|
|
1
|
-
= Purpose
|
2
|
-
|
3
|
-
ruby-shout lets you send compressed audio over the network to an Icecast
|
4
|
-
streaming media server.
|
5
|
-
|
6
|
-
= Requirements
|
7
|
-
|
8
|
-
libshout 2.0, available from icecast.org. libshout 2 requires the ogg
|
9
|
-
and vorbis libraries.
|
10
|
-
|
11
|
-
= Summary of usage
|
12
|
-
|
13
|
-
This extension follows python-shout fairly closely. You make a Shout
|
14
|
-
object with Shout.new, set its properties, tell it to connect, then
|
15
|
-
send blocks of data, sync and repeat. Disconnect when done. There is
|
16
|
-
no #open that takes a block, as there is for a File or Socket: maybe later.
|
17
|
-
|
18
|
-
= Contributors
|
19
|
-
|
20
|
-
* Yauhen Kharuzhy: bugfixes and initial metadata support
|
21
|
-
|
22
|
-
= License
|
23
|
-
This is a BSD license.
|
24
|
-
|
25
|
-
Copyright (c) 2003-2005, Jared Jennings
|
26
|
-
All rights reserved.
|
27
|
-
|
28
|
-
Redistribution and use in source and binary forms, with or without
|
29
|
-
modification, are permitted provided that the following conditions are met:
|
30
|
-
|
31
|
-
* Redistributions of source code must retain the above copyright notice, this
|
32
|
-
list of conditions and the following disclaimer.
|
33
|
-
|
34
|
-
* Redistributions in binary form must reproduce the above copyright notice,
|
35
|
-
this list of conditions and the following disclaimer in the documentation
|
36
|
-
and/or other materials provided with the distribution.
|
37
|
-
|
38
|
-
* Neither the name of Jared Jennings nor the names of contributors may
|
39
|
-
be used to endorse or promote products derived from this software without
|
40
|
-
specific prior written permission.
|
41
|
-
|
42
|
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
43
|
-
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
44
|
-
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
45
|
-
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
46
|
-
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
47
|
-
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
48
|
-
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
49
|
-
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
50
|
-
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
51
|
-
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
52
|
-
|
data/example.rb
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
#!/usr/bin/ruby
|
2
|
-
|
3
|
-
# Stream all the files given on the commandline to the Icecast server on
|
4
|
-
# localhost.
|
5
|
-
|
6
|
-
require 'rubygems'
|
7
|
-
require 'shout'
|
8
|
-
|
9
|
-
BLOCKSIZE = 16384
|
10
|
-
|
11
|
-
s = Shout.new
|
12
|
-
s.host = "localhost"
|
13
|
-
s.port = 8000
|
14
|
-
s.mount = "/example.ogg"
|
15
|
-
s.user = "source"
|
16
|
-
s.pass = "hackme"
|
17
|
-
|
18
|
-
s.connect
|
19
|
-
|
20
|
-
ARGV.each do |filename|
|
21
|
-
File.open(filename) do |file|
|
22
|
-
puts "sending data from #{filename}"
|
23
|
-
m = ShoutMetadata.new
|
24
|
-
m.add 'filename', filename
|
25
|
-
s.metadata = m
|
26
|
-
|
27
|
-
while data = file.read(BLOCKSIZE)
|
28
|
-
s.send data
|
29
|
-
s.sync
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
s.disconnect
|