Class: AirPlayer::App

Inherits:
Thor
  • Object
show all
Defined in:
lib/airplayer/app.rb

Instance Method Summary collapse

Instance Method Details

#devicesObject



23
24
25
26
27
# File 'lib/airplayer/app.rb', line 23

def devices
  Device.devices.each_with_index do |device, number|
    puts "#{number}: #{device.name} (Resolution: #{device.info.resolution}, Version: #{device.info.os_version}, IP: #{device.address})"
  end
end

#play(target) ⇒ Object



11
12
13
14
15
16
17
18
19
20
# File 'lib/airplayer/app.rb', line 11

def play(target)
  YoutubeDl.path = options[:youtube_dl]
  controller = Controller.new(device: options.fetch('device', 0))

  Playlist.new(options).add(target).entries do |media|
    controller.play(media)
    controller.pause
  end
rescue Interrupt # capture Ctrl-C
end

#versionObject



31
32
33
# File 'lib/airplayer/app.rb', line 31

def version
  puts VERSION
end