Skip to content

Commit

Permalink
latest and greatest shoutr
Browse files Browse the repository at this point in the history
  • Loading branch information
Dayne Broderson committed May 24, 2008
1 parent e47ab07 commit 0abe88a
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 12 deletions.
3 changes: 3 additions & 0 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ I. Prerequisites:
centos/fedora: yum install mpg123
- vorbis-tools # provides oggenc
centos/fedora: yum install vorbis-tools
- id3lib
centos/fedora: yum install id3lib
- id3lib-ruby # gem install id3lib-ruby

II. Setup:
==========
Expand Down
24 changes: 17 additions & 7 deletions shoutr
Original file line number Diff line number Diff line change
@@ -1,23 +1,30 @@
#!/usr/bin/ruby

# Stream all the files given on the commandline to the Icecast server on
# localhost.

# originally started from example 'shoutit.rb' from ruby-shout gem

$: << File.join( File.dirname( File.readlink(__FILE__) ), './lib' )
require 'rubygems'
require 'shout'
require 'yaml'
require 'id3lib'

BLOCKSIZE = 16384

c = YAML.load_file(File.join(File.dirname(File.readlink(__FILE__)),'config.yml'))
s = Shout.new
s.host = c[:host] || "localhost" # beef.gina.alaska.edu
s.port = c[:port] || "8000" # 8008
s.mount = c[:mount] || "/shoutr" #
s.user = c[:user] || "source" #
s.password = c[:password] || "hackme" #
s.host = c[:host] || "localhost" # beef.gina.alaska.edu
s.port = c[:port] || "8000" # 8008
s.mount = c[:mount] || "/shoutr" #
s.user = c[:user] || "source" #
s.password = c[:password] || "hackme" #
s.description = c[:description] || ""
s.public = c[:public] || false
s.url = c[:url] || "http://github.com/dayne/shoutr"
s.genre = c[:genre] || ""
s.name = c[:name] || ""


s.connect

Expand All @@ -38,7 +45,10 @@ ARGV.each do |filename|
next unless target
if File.extname(target).downcase == '.mp3'
puts "got an mp3 file, trying new code"
cmd = ("mpg123 -q -w - \"#{target}\" | oggenc -c \"#{target}\" -Q -")
tag = ID3Lib::Tag.new(target)
cmd = "mpg123 -q -w - \"#{target}\" " +
" | oggenc -a \"#{tag.artist}\" -t \"#{tag.title}\" " +
" -c \"#{target}\" -Q -"
IO.popen(cmd,'r') { |p| send_io(s,p,filename) }
elsif File.extname(target).downcase == '.ogg'
puts "got an ogg file, using old code"
Expand Down
11 changes: 6 additions & 5 deletions spec/playlist_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,10 @@
lambda {@p.copy(13,0)}.should raise_error("Out of Bounds")
end

specify "shuffling test" do
@p.shuffle
pp @p
@p[0].should != "a"
end
# no shuffle yet
# specify "shuffling test" do
# @p.shuffle
# pp @p
# @p[0].should != "a"
# end
end

0 comments on commit 0abe88a

Please sign in to comment.