airplay 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,30 @@
1
+ # Airplay
2
+
3
+ A client (and someday a server) of the superfancy http content stream technique
4
+ that Apple uses in its products.
5
+
6
+ You can try this in an AppleTV for instance.
7
+
8
+ ## Basic Usage
9
+
10
+ ```ruby
11
+ require 'airplay'
12
+
13
+ airplay = Airplay::Client.new
14
+ # To send an image
15
+ airplay.send_image("fancy_pants.jpg")
16
+ # To stream a video
17
+ airplay.send_video("http://www.yo-yo.org/mp4/yu2.mp4")
18
+ ```
19
+
20
+ ## Useful methods
21
+
22
+ ```ruby
23
+ require 'airplay'
24
+
25
+ airplay = Airplay::Client.new
26
+ airplay.browse
27
+ #=> [#<Airplay::Node:0x007fbb5a83eb28 @name="elCuervo", @domain="local.", @ip="10.1.0.63">, #<Airplay::Node:0x007fbb5a83b0b8 @name="Apple TV", @domain="local.", @ip="10.1.0.220">]
28
+ airplay.use "elCuervo"
29
+ airplay.use "Apple TV"
30
+ ```
@@ -1,13 +1,13 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "airplay"
3
- s.version = "0.1.3"
3
+ s.version = "0.1.4"
4
4
  s.summary = "Airplay client"
5
5
  s.description = "Send image/video to an airplay enabled device"
6
6
  s.authors = ["elcuervo"]
7
7
  s.email = ["yo@brunoaguirre.com"]
8
8
  s.homepage = "http://github.com/elcuervo/airplay"
9
9
  s.files = `git ls-files`.split("\n")
10
- s.test_files = `git ls-files spec`.split("\n")
10
+ s.test_files = `git ls-files spec`.split("\n")
11
11
 
12
12
  s.add_dependency("dnssd")
13
13
  s.add_development_dependency("cutest")
@@ -3,7 +3,7 @@ class Airplay::Client
3
3
 
4
4
  def initialize(server = false)
5
5
  browse unless server
6
- use servers.first if servers.size == 1
6
+ use servers.first if servers.any?
7
7
  end
8
8
 
9
9
  def use(server)
@@ -11,8 +11,10 @@ class Airplay::Protocol
11
11
  end
12
12
 
13
13
  def make_request(request)
14
- response = @http.request(request)
15
- raise Airplay::Protocol::InvalidRequestError if response.code == "404"
14
+ Thread.new do |t|
15
+ response = @http.request(request)
16
+ raise Airplay::Protocol::InvalidRequestError if response.code == "404"
17
+ end
16
18
  true
17
19
  end
18
20
 
@@ -11,7 +11,6 @@ class Airplay::Protocol::Image < Airplay::Protocol
11
11
  }
12
12
  end
13
13
 
14
-
15
14
  def transition_header(transition)
16
15
  {"X-Apple-Transition" => transitions.fetch(transition)}
17
16
  end
@@ -7,7 +7,7 @@ scope do
7
7
  end
8
8
 
9
9
  test "browse for available airplay servers" do
10
- assert_equal 1, @airplay.servers.size
10
+ assert @airplay.servers.size > 0
11
11
  end
12
12
 
13
13
  test "find servers by name" do
@@ -3,7 +3,7 @@ require File.expand_path("helper", File.dirname(__FILE__))
3
3
  scope do
4
4
  test "check image protocol class" do
5
5
  image_protocol = Airplay::Protocol::Image.new("127.0.0.1")
6
- assert_equal "/photos", image_protocol.resource
6
+ assert_equal "/photo", image_protocol.resource
7
7
  end
8
8
  end
9
9
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: airplay
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,12 +9,12 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-08-17 00:00:00.000000000 -03:00
12
+ date: 2011-08-19 00:00:00.000000000 -03:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: dnssd
17
- requirement: &70150531487960 !ruby/object:Gem::Requirement
17
+ requirement: &70215413744060 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: '0'
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *70150531487960
25
+ version_requirements: *70215413744060
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: cutest
28
- requirement: &70150531487320 !ruby/object:Gem::Requirement
28
+ requirement: &70215413743480 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ! '>='
@@ -33,10 +33,10 @@ dependencies:
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
- version_requirements: *70150531487320
36
+ version_requirements: *70215413743480
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: capybara
39
- requirement: &70150531486820 !ruby/object:Gem::Requirement
39
+ requirement: &70215413742900 !ruby/object:Gem::Requirement
40
40
  none: false
41
41
  requirements:
42
42
  - - ! '>='
@@ -44,7 +44,7 @@ dependencies:
44
44
  version: '0'
45
45
  type: :development
46
46
  prerelease: false
47
- version_requirements: *70150531486820
47
+ version_requirements: *70215413742900
48
48
  description: Send image/video to an airplay enabled device
49
49
  email:
50
50
  - yo@brunoaguirre.com
@@ -53,6 +53,7 @@ extensions: []
53
53
  extra_rdoc_files: []
54
54
  files:
55
55
  - .gitignore
56
+ - README.md
56
57
  - Rakefile
57
58
  - airplay.gemspec
58
59
  - lib/airplay.rb