class Sonos::Cli
Public Instance Methods
destroy_alarm(alarm_id)
click to toggle source
# File lib/sonos/cli.rb, line 87 def destroy_alarm(alarm_id) speakers[0].destroy_alarm(alarm_id) end
devices()
click to toggle source
# File lib/sonos/cli.rb, line 7 def devices system.devices.each do |device| puts device.name.ljust(20) + device.ip end end
disable_alarm(alarm_id)
click to toggle source
# File lib/sonos/cli.rb, line 77 def disable_alarm(alarm_id) speakers[0].disable_alarm(alarm_id) end
enable_alarm(alarm_id)
click to toggle source
# File lib/sonos/cli.rb, line 72 def enable_alarm(alarm_id) speakers[0].enable_alarm(alarm_id) end
groups()
click to toggle source
# File lib/sonos/cli.rb, line 41 def groups system.groups.each do |group| puts group.master_speaker.name.ljust(20) + group.master_speaker.ip group.slave_speakers.each do |speaker| puts speaker.name.rjust(10).ljust(20) + speaker.ip end puts "\n" end end
is_alarm_enabled?(alarm_id)
click to toggle source
# File lib/sonos/cli.rb, line 67 def is_alarm_enabled?(alarm_id) puts speakers[0].is_alarm_enabled?(alarm_id) end
list_alarms()
click to toggle source
# File lib/sonos/cli.rb, line 62 def list_alarms puts speakers[0].list_alarms end
party_mode()
click to toggle source
# File lib/sonos/cli.rb, line 31 def party_mode system.party_mode end
party_over()
click to toggle source
# File lib/sonos/cli.rb, line 36 def party_over system.party_over end
pause_all()
click to toggle source
# File lib/sonos/cli.rb, line 21 def pause_all system.pause_all end
play_all()
click to toggle source
# File lib/sonos/cli.rb, line 26 def play_all system.play_all end
set_alarm_volume(alarm_id, volume)
click to toggle source
# File lib/sonos/cli.rb, line 82 def set_alarm_volume(alarm_id, volume) speakers[0].set_alarm_volume(alarm_id, volume) end
speaker(name, command, *args)
click to toggle source
# File lib/sonos/cli.rb, line 54 def speaker(name, command, *args) speakers = system.speakers.select { |s| s.name.downcase == name.downcase } puts "Could not find speaker" and return if speakers.length == 0 speakers.each { |s| s.send command, *args } end
speakers()
click to toggle source
# File lib/sonos/cli.rb, line 14 def speakers system.speakers.each do |speaker| puts speaker.name.ljust(20) + speaker.ip end end
Private Instance Methods
system()
click to toggle source
# File lib/sonos/cli.rb, line 93 def system @system ||= Sonos::System.new end