airplay-cli 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +7 -0
  2. data/bin/air +12 -2
  3. data/lib/airplay/cli.rb +35 -0
  4. metadata +9 -17
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: a34c7f9420b1c68dc297160cf92bd7bef301da98
4
+ data.tar.gz: 07b8db72d5b3360b934f1a43da05ce504852964a
5
+ SHA512:
6
+ metadata.gz: dc6f362d78406675493c70e16683a4c7806fc7ce00950cbdb5d9e61ab5d294795bec3920f93044fb4421f6821bcc48ee6cba76b21f502ae06f4039fb936a667a
7
+ data.tar.gz: b4e4c9840bf88ddd7c0442407bda79beb79428b637f4cab37fb455f9bdb66aa43c802c4847c2dbf8ac011b1302290c6eebe68ec33b2d73c0e9a5d50c7b34c34c
data/bin/air CHANGED
@@ -7,24 +7,34 @@ require "airplay/cli/version"
7
7
  begin
8
8
  Clap.run ARGV,
9
9
  "--device" => lambda { |device_name| @device = Airplay[device_name] },
10
+ "--url" => lambda { |url| @url = url },
10
11
  "--wait" => lambda { |sec| @wait = sec.to_i },
11
12
  "--interactive" => lambda { @interactive = true },
13
+ "--password" => lambda { |password| @password = password },
12
14
 
13
15
  "help" => Airplay::CLI.method(:help),
14
16
 
15
17
  "list" => Airplay::CLI.method(:list),
16
18
 
19
+ "doctor" => Airplay::CLI.method(:doctor),
20
+
17
21
  "version" => Airplay::CLI.method(:version),
18
22
 
19
23
  "play" => lambda { |video|
20
- options = { device: @device || Airplay.devices.first }
24
+ options = {
25
+ device: @device || Airplay.devices.first,
26
+ password: @password || false,
27
+ url: @url || false
28
+ }
21
29
  Airplay::CLI.play(video, options)
22
30
  },
23
31
 
24
32
  "view" => lambda { |file|
25
33
  options = {
26
- device: @device || Airplay.devices.first,
34
+ device: @device || @url ? false : Airplay.devices.first,
27
35
  interactive: @interactive || false,
36
+ password: @password || false,
37
+ url: @url || false,
28
38
  wait: @wait || 3
29
39
  }
30
40
  Airplay::CLI.view(file, options)
@@ -1,6 +1,7 @@
1
1
  require "ruby-progressbar"
2
2
  require "airplay"
3
3
  require "airplay/cli/image_viewer"
4
+ require "airplay/cli/doctor"
4
5
 
5
6
  # Public: Airplay core module
6
7
  #
@@ -28,12 +29,15 @@ module Airplay
28
29
  version - The current airplay-cli version.
29
30
  play - Plays a local or remote video.
30
31
  view - Shows an image or a folder of images, can be an url.
32
+ doctor - Shows some debug information to trace bugs.
31
33
 
32
34
  Options:
33
35
 
34
36
  --device - Name of the device where it should be played (Default: The first one)
35
37
  --wait - The wait time for playing an slideshow (Default: 3)
36
38
  --interactive - Control the slideshow using left and right arrows.
39
+ --password - Adds the device password
40
+ --url - Allows you to specify an Apple TV url
37
41
 
38
42
  EOS
39
43
  end
@@ -47,6 +51,8 @@ module Airplay
47
51
  puts <<-EOS.gsub(/^\s{12}/,'')
48
52
  * #{device.name} (#{device.info.model} running #{device.info.os_version})
49
53
  ip: #{device.ip}
54
+ mac: #{device.id}
55
+ password?: #{device.password? ? "yes" : "no"}
50
56
  type: #{device.type}
51
57
  resolution: #{device.info.resolution}
52
58
 
@@ -64,6 +70,12 @@ module Airplay
64
70
  #
65
71
  def play(video, options)
66
72
  device = options[:device]
73
+ password = options[:password]
74
+ url = options[:url]
75
+
76
+ Airplay.devices.add("Apple TV", url) if url
77
+ device.password = password if password
78
+
67
79
  player = device.play(video)
68
80
  puts "Playing #{video}"
69
81
  bar = ProgressBar.create(
@@ -78,6 +90,20 @@ module Airplay
78
90
  player.wait
79
91
  end
80
92
 
93
+ def doctor
94
+ puts <<-EOS.gsub!(" "*10, "")
95
+
96
+ This will run some basic tests on your network trying to find errors
97
+ and debug information to help fix them.
98
+
99
+ EOS
100
+
101
+ who = Airplay::CLI::Doctor.new
102
+
103
+ puts "Running dns-sd tests:"
104
+ who.information
105
+ end
106
+
81
107
  # Public: Show an image given a device
82
108
  #
83
109
  # file_or_dir - The url, file path or folder path to the image/s
@@ -90,6 +116,15 @@ module Airplay
90
116
  #
91
117
  def view(file_or_dir, options)
92
118
  device = options[:device]
119
+ password = options[:password]
120
+ url = options[:url]
121
+
122
+ if url
123
+ Airplay.configure { |c| c.autodiscover = false }
124
+ device = Airplay.devices.add("Apple TV", url)
125
+ end
126
+ device.password = password if password
127
+
93
128
  viewer = ImageViewer.new(device, options)
94
129
 
95
130
  if File.directory?(file_or_dir)
metadata CHANGED
@@ -1,36 +1,32 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: airplay-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
5
- prerelease:
4
+ version: 1.0.2
6
5
  platform: ruby
7
6
  authors:
8
7
  - elcuervo
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-11-07 00:00:00.000000000 Z
11
+ date: 2014-05-01 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: airplay
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - '='
20
18
  - !ruby/object:Gem::Version
21
- version: 1.0.2
19
+ version: 1.0.3
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - '='
28
25
  - !ruby/object:Gem::Version
29
- version: 1.0.2
26
+ version: 1.0.3
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: clap
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
31
  - - ~>
36
32
  - !ruby/object:Gem::Version
@@ -38,7 +34,6 @@ dependencies:
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
38
  - - ~>
44
39
  - !ruby/object:Gem::Version
@@ -46,7 +41,6 @@ dependencies:
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: ruby-progressbar
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
45
  - - ~>
52
46
  - !ruby/object:Gem::Version
@@ -54,7 +48,6 @@ dependencies:
54
48
  type: :runtime
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
52
  - - ~>
60
53
  - !ruby/object:Gem::Version
@@ -73,26 +66,25 @@ homepage: http://github.com/elcuervo/airplay
73
66
  licenses:
74
67
  - MIT
75
68
  - HUGWARE
69
+ metadata: {}
76
70
  post_install_message:
77
71
  rdoc_options: []
78
72
  require_paths:
79
73
  - lib
80
74
  required_ruby_version: !ruby/object:Gem::Requirement
81
- none: false
82
75
  requirements:
83
- - - ! '>='
76
+ - - '>='
84
77
  - !ruby/object:Gem::Version
85
78
  version: '0'
86
79
  required_rubygems_version: !ruby/object:Gem::Requirement
87
- none: false
88
80
  requirements:
89
- - - ! '>='
81
+ - - '>='
90
82
  - !ruby/object:Gem::Version
91
83
  version: '0'
92
84
  requirements: []
93
85
  rubyforge_project:
94
- rubygems_version: 1.8.23
86
+ rubygems_version: 2.0.14
95
87
  signing_key:
96
- specification_version: 3
88
+ specification_version: 4
97
89
  summary: Airplay CLI
98
90
  test_files: []