Giter Site home page Giter Site logo

sonos's Introduction

Sonos

Control Sonos speakers with Ruby.

Huge thanks to Rahim Sonawalla for making SoCo. This gem would not be possible without his work.

Code Climate Dependency Status

Installation

Add this line to your application's Gemfile:

gem 'sonos'

And then execute:

$ bundle

Or install it yourself as:

$ gem install sonos

Usage

I'm working on a CLI client. For now, we'll use IRB.

$ gem install sonos
$ irb
require 'rubygems'
require 'sonos'
system = Sonos::System.new # Auto-discovers your system
speaker = system.speakers.first

Now that we have a reference to the speaker, we can do all kinds of stuff.

speaker.pause # Pause whatever is playing
speaker.play  # Resumes the playlist
speaker.play 'http://assets.samsoff.es/music/Airports.mp3' # Stream!
speaker.now_playing
speaker.volume
speaker.volume = 70
speaker.volume -= 10
speaker.queue
speaker.add_to_queue 'http://assets.samsoff.es/music/Airports.mp3'
speaker.remove_from_queue(speaker.queue[:items].last[:queue_id])
speaker.save_queue 'Jams'
speaker.clear_queue

Topology

Sonos.discover finds the first speaker it can. We can get all of the Sonos devices (including Bridges, etc) by calling Sonos.system.devices. To get the groups, call Sonos.system.groups.

All of this is based off of the raw Sonos.system.topology.

CLI

There is a very limited CLI right now. You can run sonos devices to get the IP of all of your devices.

You can also run sonos pause_all to pause all your Sonos groups.

To Do

General

  • Handle errors better
  • Handle line-in in now_playing
  • Detect fixed volume
  • Detect stereo pair
  • CLI client for everything
  • Nonblocking calls with Celluloid::IO

Features

  • Manipulating groups doesn't update System#groups
  • Pause all (there is no play all in the controller, we could loop through and do it though)
  • Party Mode
  • Line-in
  • Toggle cross fade
  • Toggle shuffle
  • Set repeat mode
  • Search music library
  • Browse music library
  • Skip to song in queue
  • Alarm clock
  • Sleep timer
  • Pandora doesn't use the Queue. I bet things are all jacked up.
  • CONNECT (and possibly PLAY:5) line in settings
    • Source name
    • Level
    • Autoplay room
    • Autoplay include grouped rooms

Maybe

If we are implementing everything the official Sonos Controller does, here's some more stuff:

  • Set zone name and icon
  • Create stero pair
  • Support for SUB
  • Support for DOCK
  • Support for CONNECT:AMP (not sure if this is any different from CONNECT)
  • Manage services
  • Date and time
  • Wireless channel
  • Audio compression
  • Automatically check for updates (not sure if this is a controller only preference)
  • Local music servers
  • Add component

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

sonos's People

Contributors

soffes avatar gotwalt avatar constantinexvi avatar meltingice avatar evenv avatar jontg avatar

Watchers

Gerardo Capiel avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.