druzy-protocol-plugin-upnp 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 12bfde020b1c1459f480e2fdb040df24f0f1a494
4
- data.tar.gz: 27ead9847637fceb7481627847b06b4425f7056b
3
+ metadata.gz: 2c566c6087400eb309fcbfb2e6d667a0f0830687
4
+ data.tar.gz: 52f7c57677bd748e6f7a93416adca8302d1b18fc
5
5
  SHA512:
6
- metadata.gz: 1f21e48242a26aee06021d4bae205851dd8b5ac778f2254ef93dafbd26c73ca923c95a5755ed3278b7ac14d44db6266697d654f3eb314814652ca2ca2ce90d28
7
- data.tar.gz: 4f1e6890821e754284048e1d92942e913865092892269a4b6a1c9e7d1a6bd10bd1927a1e8077a1f0f5cc46eb277109a78b8aa806723aa32467f2c0419626b936
6
+ metadata.gz: d4eea128747f19f3c9f8a8fe5fb79a792949fb521e121246db6ac0db1c3599aaa0d1f5fc56cee40c39548e474d3b541040f967f6cd0b1cd1b19aafc6ad320d3a
7
+ data.tar.gz: 49573c9e4fdbbf92badacc83130049215cc585bcffca039616c4496e4a9d7cdfb40f03ed50eed07ec8498fc50c0a50c15c853752cf38e3a7a7392cd4d0710151
@@ -10,55 +10,57 @@ module Druzy
10
10
  module Protocol
11
11
  module Plugin
12
12
  module Upnp
13
-
13
+
14
14
  PORT=15322
15
-
15
+
16
16
  class UpnpDiscoverer < Druzy::Protocol::Discoverer
17
-
18
- @@urn_media_renderer = "urn:schemas-upnp-org:device:MediaRenderer:1"
19
-
20
- def start_discoverer(args={})
21
- args[:delay] ||=10
22
- args[:identifier] ||=@@urn_media_renderer
23
- searcher = Druzy::Upnp::Ssdp.new.search(args[:identifier], args[:delay]) do |device|
17
+
18
+ def start_discoverer(kwargs={})
19
+ kwargs[:delay] ||=10
20
+ kwargs[:identifier] ||= Druzy::Upnp::Ssdp::MEDIA_RENDERER if kwargs[:type] == 'renderer'
21
+ kwargs[:identifier] ||= Druzy::Upnp::Ssdp::MEDIA_SERVER if kwargs[:type] == 'server'
22
+
23
+ searcher = Druzy::Upnp::Ssdp.new.search(kwargs[:identifier], kwargs[:delay]) do |device|
24
24
  if block_given?
25
- yield UpnpRenderer.new(device)
25
+ yield UpnpRenderer.new(device) if kwargs[:type] == 'renderer'
26
+
27
+ #TODO yield UpnpServer.new(device) if kwargs[:type] == 'server'
26
28
  end
27
29
  end
28
30
  end
29
-
31
+
30
32
  def stop_discoverer
31
33
  end
32
-
34
+
33
35
  def restart_discoverer
34
36
  end
35
37
  end
36
-
38
+
37
39
  class UpnpRenderer < Druzy::Protocol::Renderer
38
-
40
+
39
41
  def initialize(druzy_device)
40
42
  @druzy_device = druzy_device
41
43
 
42
44
  @av_transport_id=nil
43
45
  @connection_id=nil
44
46
  @rcs_id=nil
45
-
47
+
46
48
  super(@druzy_device.udn,"upnp",@druzy_device.friendly_name,@druzy_device.icon_list.first)
47
-
49
+
48
50
  end
49
-
51
+
50
52
  def play
51
53
  @druzy_device.AVTransport.Play("InstanceID" => @av_transport_id, "Speed" => 1)
52
54
  end
53
-
55
+
54
56
  def pause
55
57
  @druzy_device.AVTransport.Pause("InstanceID" => @av_transport_id)
56
58
  end
57
-
59
+
58
60
  def stop
59
61
  @druzy_device.AVTransport.Stop("InstanceID" => @av_transport_id)
60
62
  end
61
-
63
+
62
64
  def send(file)
63
65
  #vérification du protocol
64
66
  protocols = @druzy_device.ConnectionManager.GetProtocolInfo["Sink"]
@@ -69,12 +71,12 @@ module Druzy
69
71
  ids=@druzy_device.ConnectionManager.PrepareForConnection("RemoteProtocolInfo" => ask_protocol, "PeerConnectionManager" => "/", "PeerConnectionID" => -1, "Direction" => "Output")
70
72
  @connection_id = ids["ConnectionID"]
71
73
  @av_transport_id = ids["AVTransportID"]
72
- @rcs_id = ids["RcsID"]
74
+ @rcs_id = ids["RcsID"]
73
75
  end
74
76
  #ajout du fichier au serveur
75
77
  r=Druzy::Server::RestrictedFileServer.instance(PORT)
76
78
  r.add_file(file)
77
-
79
+
78
80
  #preparation de currentUriMetadata
79
81
  xml = %Q(<DIDL-Lite xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:upnp="urn:schemas-upnp-org:metadata-1-0/upnp/" xmlns="urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/">
80
82
  <item id="#{r.get_address(file)}" parentID="0" restricted="false">
@@ -91,24 +93,24 @@ module Druzy
91
93
  #envoie de l'url au renderer
92
94
  @druzy_device.AVTransport.SetAVTransportURI("InstanceID" => @av_transport_id, "CurrentURI" => r.get_address(file), "CurrentURIMetaData" => xml)
93
95
  end
94
-
96
+
95
97
  end
96
-
98
+
97
99
  end
98
-
100
+
99
101
  end
100
102
  end
101
103
  end
102
104
  end
103
105
 
104
106
  if __FILE__ == $0
105
-
106
-
107
+
108
+
107
109
  up=Druzy::Protocol::Plugin::Upnp::UpnpDiscoverer.new
108
- up.start_discoverer(:delay => 10, :identifier => "uuid:aad2b343-11c8-346d-dd41-065160c19d82") do |device|
110
+ up.start_discoverer(:delay => 10, :type => 'renderer' ) do |device|
109
111
  puts device.identifier
110
112
  puts device.name
111
113
  end
112
-
114
+
113
115
  Thread.list.each{|t| t.join if t!=Thread.main}
114
- end
116
+ end
@@ -2,8 +2,8 @@ module Druzy
2
2
  module Protocol
3
3
  module Plugin
4
4
  module Upnp
5
- VERSION = "0.2.0"
5
+ VERSION = "0.3.0"
6
6
  end
7
7
  end
8
8
  end
9
- end
9
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: druzy-protocol-plugin-upnp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Le Greneur
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-07-03 00:00:00.000000000 Z
11
+ date: 2017-02-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: druzy-protocol
@@ -16,42 +16,42 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 1.0.2
19
+ version: 1.0.5
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 1.0.2
26
+ version: 1.0.5
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: druzy-server
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 1.0.0
33
+ version: 2.0.1
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: 1.0.0
40
+ version: 2.0.1
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: druzy-upnp
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: 2.0.1
47
+ version: 3.0.2
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: 2.0.1
54
+ version: 3.0.2
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: ruby-filemagic
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -72,28 +72,28 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '1.10'
75
+ version: '1.12'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '1.10'
82
+ version: '1.12'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: rake
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '10.0'
89
+ version: '10.5'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: '10.0'
96
+ version: '10.5'
97
97
  description: Plugin to discover a upnp media renderer, just install it
98
98
  email:
99
99
  - jonathan.legreneur@free.fr