Module: Airplay

Defined in:
lib/airplay.rb,
lib/airplay/cli.rb,
lib/airplay/group.rb,
lib/airplay/device.rb,
lib/airplay/logger.rb,
lib/airplay/player.rb,
lib/airplay/server.rb,
lib/airplay/viewer.rb,
lib/airplay/browser.rb,
lib/airplay/devices.rb,
lib/airplay/version.rb,
lib/airplay/playable.rb,
lib/airplay/viewable.rb,
lib/airplay/cli/doctor.rb,
lib/airplay/connection.rb,
lib/airplay/server/app.rb,
lib/airplay/cli/version.rb,
lib/airplay/device/info.rb,
lib/airplay/player/media.rb,
lib/airplay/configuration.rb,
lib/airplay/group/players.rb,
lib/airplay/player/timers.rb,
lib/airplay/device/features.rb,
lib/airplay/player/playlist.rb,
lib/airplay/cli/image_viewer.rb,
lib/airplay/player/playback_info.rb,
lib/airplay/connection/persistent.rb,
lib/airplay/connection/authentication.rb

Overview

Public: Airplay core module

Defined Under Namespace

Modules: CLI, Playable, Viewable Classes: Browser, Configuration, Connection, Device, Devices, Group, Logger, Player, Server, Viewer

Constant Summary collapse

VERSION =
"1.0.5"

Class Method Summary collapse

Class Method Details

.[](device_name) ⇒ Object

Public: Access a device by name

device_name - The name to search on the devices

Returns the found device



80
81
82
# File 'lib/airplay.rb', line 80

def [](device_name)
  devices.find_by_name(device_name)
end

.allObject

Public: Helper method to access all the devices

Returns a Group with all the devices.



49
50
51
52
53
54
55
# File 'lib/airplay.rb', line 49

def all
  @_all ||= begin
    group = Group.new(:all)
    devices.each { |device| group << device }
    group
  end
end

.browseObject

Public: Browses for devices in the current network

Returns nothing.



33
34
35
# File 'lib/airplay.rb', line 33

def browse
  browser.browse
end

.configurationObject

Public: Access the configuration object

Returns the Configuration object



70
71
72
# File 'lib/airplay.rb', line 70

def configuration
  @_configuration ||= Configuration.new
end

.configure {|configuration| ... } ⇒ Object

Public: General configuration

&block - The block that will modify the configuration

Returns the configuration file.

Yields:



17
18
19
# File 'lib/airplay.rb', line 17

def configure(&block)
  yield(configuration) if block
end

.devicesObject

Public: Lists found devices if autodiscover is enabled

Returns an Array with all the devices



61
62
63
64
# File 'lib/airplay.rb', line 61

def devices
  browse if browser.devices.empty? && configuration.autodiscover
  browser.devices
end

.groupObject

Public: Access or create a group based on a key

Returns the Hash object.



41
42
43
# File 'lib/airplay.rb', line 41

def group
  @_group ||= Hash.new { |h, k| h[k] = Group.new(k) }
end

.serverObject

Public: Access the server object

Returns the Server object



25
26
27
# File 'lib/airplay.rb', line 25

def server
  @_server ||= Server.new
end