h1. Ruby-Shout

h2. Compatibility note

If you have installed a previous version of ruby-shout you have to make shure the shout.o files aren't there any more. Otherwise the build will fail.

h2. Purpose

ruby-shout lets you send compressed audio over the network to an “Icecast”:www.icecast.org/ streaming media server.

h2. Requirements

libshout 2.0, available from “icecast.org”:www.icecast.org/download.php. libshout 2 requires the ogg and vorbis libraries.

h2. Summary of usage

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.

h2. Usage

See example.rb. Run it like

<pre>./example.rb spec/test.mp3 </pre>

h2. Ruby 1.9 and encoding

Ruby 1.9 features really good encoding support: Each string has it's own explicit encoding. The default encoding for Icecast is ISO-8859-1 for station data and meta data.

In order to make ruby-shout play nice with ruby 1.9 I added a Shout#charset setter and all string accessors for station data are wrapped:

The idea is: We want to guaranty that strings keep their encoding when assigning them via a Shout accessor. In case strings are not compatible with Icecasts charset we want to degrade as gracefully as possible. IMHO just dropping incompatible characters does this best (when being listed in an external YP directory these “???br?” things just look awful). If you want to make sure this doesn't happen you have to compare the value before and after assigning it (or just compare for example description with original_description).

h3. Synopsis:

<pre><code>s = Shout.new s.charset = 'UTF-8' s.description = 'dikşîne MUSłϾ' puts s.description # => 'dikşîne MUSłϾ'

s = Shout.new s.charset = 'ISO-8859-1' # this is the default s.description = 'dikşîne MUSłϾ' puts s.description # => 'dikîne MUSłϾ' puts s.original_description # => 'dikşîne MUSłϾ' </code></pre>

h3. Icecast charset config

If you use s/th else than ISO-8859-1 you should configure your icecast accordingly: In the mount section set the charset:

<pre><code><mount>

<mount-name>/your_station</mount-name>
<charset>UTF-8</charset>
...

</mount> </code></pre>

or (in the latest icecast builds)

<pre><code><mount>

<mount-name>/*</mount-name>
<charset>UTF-8</charset>
...

</mount> </code></pre>

to set UTF-8 for all mountpoints.

h2. Running the spec

h3. General note: use rake spec:build

Before each run you have to run the build specs first as the other specs use its output (the built gem).

<pre>rake spec:build && rake spec </pre>

h3. For the integration spec

You need to have an icecast server running. Perhaps you want to adopt the server setting quite at the top of the intergration_spec.rb

h2. Todo

h2. History & Credits

h2. Recent Changes

h2. State

I tested this version of ruby-shout to build and run on

h2. License This is a BSD license.

Copyright © 2003-2005, Jared Jennings Copyright © 2010, Niko Dittmann

All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.