Sha256: dcdfa2558e75aae0d77aea20d0a12bdaa4c50066d1f851a33f928a5933a39ccc

Contents?: true

Size: 572 Bytes

Versions: 2

Compression:

Stored size: 572 Bytes

Contents

module AirPlayer
  class Device
    def initialize
      @airplay = Airplay::Client.new
    rescue Airplay::Client::ServerNotFoundError
      abort "[ERROR] AirPlay device is not found"
    end

    def default
      @airplay.browse.first
    end

    def exist?(device_number)
      !!@airplay.browse.at(device_number)
    end

    def get(device_number)
      @airplay.browse[device_number]
    end

    def list
      @airplay.browse.each_with_index do |device, number|
        puts "#{number}: #{device.name} (#{device.ip}:#{device.port})"
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
airplayer-0.0.8 lib/airplayer/device.rb
airplayer-0.0.7 lib/airplayer/device.rb