Squeezer: Ruby Squeezebox Gem

A Ruby wrapper for the Squeezebox Server CLI API.

WORK IN PROGRESS

This project is in it's early stages, it is not finished by any means. Feel free to comment with help or criticism!

It also lacks proper error handling and documentation. Most of the critical refactor points have been marked with a 'todo' comment.

  • active record like search methods and model relations (database, chained search engine?)
  • playlist handling
  • add convenience methods
  • add some more sugar

Installation

gem install squeezer-ruby

Usage Examples

General:

require "squeezer"

Squeezer.configure do |config|
  config.server = "127.0.0.1"
  config.port = 9090
end

# execute block and close the connection when done
Squeezer.open do |client|
  puts client.version
  puts Track.total
end

# or start a client and call exit manually
client = Squeezer::Client.new
client.players.each do |id, player|
  puts "Name: #{player.name}"
  puts "Model: #{player.model}"
  puts "Signal: #{player.signal_strength}" if player.wireless?
  puts "Volume: #{player.volume}"

  player.on! if player.off?

  player.volume = "+40"
end

client.artists.each do |artist|
  puts artist.name
end

client.exit

Models:

begin
  include Squeezer::Models

  puts Player.find_by_name("living room").ip
  puts Player.find_by_ip("192.168.1.1").name

  Artist.all.each do |artist|
     puts artist.name
  end

  puts Album.total
end

Testing

Run all tests:

rake tests:run

Start Spork DRb server, for faster testing:

rake tests:spork

Run a continuous testing environment with autotest (configure .autotest for your own needs):

rake tests:autotest

Copyright (c) 2011 Daniël van Hoesel. See LICENSE for details.