airplay 1.0.0.beta3 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -24,6 +24,12 @@ module Airplay
24
24
  start!
25
25
  end
26
26
 
27
+ # Public: Adds a file to serve
28
+ #
29
+ # file - The file path to be served
30
+ #
31
+ # Returns the url that the file will have
32
+ #
27
33
  def serve(file)
28
34
  sleep 0.1 until running?
29
35
  asset_id = App.settings[:assets][file]
@@ -31,12 +37,20 @@ module Airplay
31
37
  "http://#{private_ip}:#{@port}/assets/#{asset_id}"
32
38
  end
33
39
 
40
+ # Public: Starts the server in a new thread
41
+ #
42
+ # Returns nothing
43
+ #
34
44
  def start!
35
45
  Thread.start { @server.start }
36
46
  end
37
47
 
38
48
  private
39
49
 
50
+ # Private: Checks the state if the server by attempting a connection to it
51
+ #
52
+ # Returns a boolean with the state
53
+ #
40
54
  def running?
41
55
  begin
42
56
  socket = TCPSocket.new(private_ip, @port)
@@ -47,6 +61,10 @@ module Airplay
47
61
  end
48
62
  end
49
63
 
64
+ # Private: The local ip of the machine
65
+ #
66
+ # Returns the ip address of the current machine
67
+ #
50
68
  def private_ip
51
69
  @_ip ||= Socket.ip_address_list.detect do |addr|
52
70
  addr.ipv4_private?
@@ -1,3 +1,3 @@
1
1
  module Airplay
2
- VERSION = "1.0.0.beta3"
2
+ VERSION = "1.0.0"
3
3
  end
@@ -9,6 +9,10 @@ module Airplay
9
9
 
10
10
  private
11
11
 
12
+ # Private: The Viewer handler
13
+ #
14
+ # Returns a Viewer object
15
+ #
12
16
  def viewer
13
17
  @_viewer ||= Airplay::Viewer.new(self)
14
18
  end
@@ -13,6 +13,12 @@ module Airplay
13
13
 
14
14
  # Public: Broadcasts the content to the device
15
15
  #
16
+ # media_or_io - The url, file path or io of the image/s
17
+ # options - Options that include the device
18
+ # * transition: the type of transition (Default: None)
19
+ #
20
+ # Returns if the images was actually sent
21
+ #
16
22
  def view(media_or_io, options = {})
17
23
  content = get_content(media_or_io)
18
24
  transition = options.fetch(:transition, "None")
@@ -28,17 +34,27 @@ module Airplay
28
34
  response.response.status == 200
29
35
  end
30
36
 
37
+ # Public: The list of transitions
38
+ #
39
+ # Returns the list of trasitions
40
+ #
31
41
  def transitions; TRANSITIONS end
32
42
 
33
43
  private
34
44
 
45
+ # Public: The connection
46
+ #
47
+ # Returns the connection
48
+ #
35
49
  def connection
36
50
  @_connection ||= Airplay::Connection.new(@device)
37
51
  end
38
52
 
39
53
  # Private: Gets the content of the possible media_or_io
40
54
  #
41
- # media_or_io - The url, file, path or read compatible source
55
+ # media_or_io - The url, file, path or read compatible source
56
+ #
57
+ # Returns the content of the media
42
58
  #
43
59
  def get_content(media_or_io)
44
60
  case true
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: airplay
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.beta3
5
- prerelease: 6
4
+ version: 1.0.0
5
+ prerelease:
6
6
  platform: ruby
7
7
  authors:
8
8
  - elcuervo
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-10-22 00:00:00.000000000 Z
12
+ date: 2013-10-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: dnssd
@@ -218,21 +218,21 @@ files:
218
218
  - LICENSE
219
219
  - README.md
220
220
  - Rakefile
221
- - SPEC.md
222
221
  - airplay-cli.gemspec
223
222
  - airplay.gemspec
224
223
  - bin/air
225
224
  - doc/contributors.md
225
+ - doc/documentation.md
226
226
  - doc/header.md
227
+ - doc/img/cli_list.png
228
+ - doc/img/cli_play.png
227
229
  - doc/img/logo.png
228
230
  - doc/installation.md
229
231
  - doc/usage.md
230
- - examples/demo.rb
231
- - examples/image.rb
232
- - examples/video.rb
233
232
  - lib/airplay.rb
234
233
  - lib/airplay/browser.rb
235
234
  - lib/airplay/cli.rb
235
+ - lib/airplay/cli/image_viewer.rb
236
236
  - lib/airplay/cli/version.rb
237
237
  - lib/airplay/configuration.rb
238
238
  - lib/airplay/connection.rb
@@ -278,9 +278,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
278
278
  required_rubygems_version: !ruby/object:Gem::Requirement
279
279
  none: false
280
280
  requirements:
281
- - - ! '>'
281
+ - - ! '>='
282
282
  - !ruby/object:Gem::Version
283
- version: 1.3.1
283
+ version: '0'
284
284
  requirements: []
285
285
  rubyforge_project:
286
286
  rubygems_version: 1.8.23
data/SPEC.md DELETED
@@ -1,34 +0,0 @@
1
- # Airplay Spec
2
-
3
- ## CLI
4
-
5
- ### Commands
6
-
7
- **play**
8
- **stop**
9
- **pause**
10
-
11
- ```bash
12
- airplay image.jpg
13
- airplay image.jpg --transition slide_left
14
-
15
- airplay video.mp4
16
- airplay> pause
17
- ```
18
-
19
- ## Library
20
-
21
- ```ruby
22
- Airplay.send("image.png", transition: :slide_left)
23
-
24
- player = Airplay.send("video.mp4")
25
- player.pause
26
- player.rewind("10s")
27
-
28
- Airplay.player
29
- ```
30
-
31
- ## Documentation
32
-
33
- * http://nto.github.com/AirPlay.html
34
- * http://elcuervo.co/protocol/airplay/apple/2012/01/05/airplay-protocol.html
@@ -1,32 +0,0 @@
1
- require "airplay"
2
-
3
- puts Airplay.devices.count
4
- Airplay.devices.each do |device|
5
- puts device.name
6
- end
7
-
8
- videos = [
9
- "http://trailers.apple.com/movies/marvel/ironman3/ironman3-tlr1-m4mb0_h1080p.mov",
10
- "http://movietrailers.apple.com/movies/dreamworks/needforspeed/needforspeed-tlr1xxzzs2_480p.mov"
11
- ]
12
-
13
- apple_tv = Airplay["Apple TV"]
14
-
15
- apple_tv.view("./test/fixtures/files/logo.png", transition: "SlideLeft")
16
- sleep 2
17
- puts apple_tv.view("./test/fixtures/files/a.png", transition: "SlideLeft")
18
- sleep 20
19
- exit
20
-
21
- videos.each do |video|
22
- player = apple_tv.play(video)
23
- sleep 10
24
- end
25
-
26
- Airplay.group["Backyard"] << Airplay["Pool TV"]
27
- Airplay.group["Backyard"] << Airplay.devices.add("BBQTV", "192.168.1.12")
28
-
29
- player = Airplay.group["Backyard"].play("video")
30
- player.wait
31
-
32
- Airplay.all # => Alias for a global group of all the available devices
@@ -1,9 +0,0 @@
1
- require "airplay"
2
-
3
- Airplay.use "corax", "corax"
4
- Airplay.configure do |c|
5
- c.log_level = "debug"
6
- end
7
-
8
- Airplay.view("http://fitdeck.com/Portals/24254/images/Sunrise.jpg")
9
- sleep 4
@@ -1,24 +0,0 @@
1
- require "airplay"
2
-
3
- Airplay.configure do |c|
4
- # c.log_level = "debug"
5
- end
6
-
7
- video = "http://trailers.apple.com/movies/marvel/ironman3/ironman3-tlr1-m4mb0_h1080p.mov"
8
-
9
- Airplay.play video
10
- puts "Starts playing: #{video}"
11
- Airplay.player.progress -> info {
12
- if info["rate"]
13
- if info["readyToPlay"]
14
- total = info["duration"]
15
- current = info["position"]
16
- percent = (current*100/total).round
17
-
18
- print "\r|#{"=" * percent}> #{percent}%"
19
- end
20
- end
21
- }
22
-
23
- Airplay.player.wait
24
- puts "Video playback finished!"