vlc-client 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +6 -1
- data/README.md +1 -1
- data/lib/vlc-client.rb +1 -2
- data/lib/vlc-client/server.rb +29 -6
- data/lib/vlc-client/version.rb +1 -1
- data/spec/helper.rb +12 -30
- data/spec/system_spec.rb +0 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ae9ecda809fe61433d61d38c263715eebc2d99f3
|
4
|
+
data.tar.gz: 46c6ef80d8507cb05d6a32f0f274e7eaf629cfbb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e6f404e88f192deca0dd42e1acef2d4808bb70675b5a2a370cb293e9056e905fe1346f8ca56fc42b0780bb279ae47b5a9eb5df73fbe73cafd838ad95b0169cf2
|
7
|
+
data.tar.gz: 41e9cda0d0b842f7a7e4e25917a7ae5cbc3c4bfd7623465a99e5dda5a7675342eb9e6640ac01abfdacc394e20849cc3cd67af996ef1b0d99d9d0b5f61d38143c
|
data/.travis.yml
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
before_install:
|
2
|
+
#This is a temporary workaround a rubygems bug! Remove later
|
3
|
+
#see: https://github.com/bundler/bundler/issues/2784 & https://github.com/rubygems/rubygems/pull/763
|
4
|
+
- gem update --system 2.1.11
|
5
|
+
- gem --version
|
1
6
|
language: ruby
|
2
7
|
script: bundle exec rake --verbose --trace
|
3
8
|
bundler_args: --without development
|
@@ -10,4 +15,4 @@ rvm:
|
|
10
15
|
- 1.9.2
|
11
16
|
- 1.9.3
|
12
17
|
- 2.0.0
|
13
|
-
- ruby-head
|
18
|
+
- ruby-head
|
data/README.md
CHANGED
@@ -90,7 +90,7 @@ vlc.connect
|
|
90
90
|
|
91
91
|
## Notice
|
92
92
|
|
93
|
-
vlc-client has been tested on linux but it should work on any VLC installation as long
|
93
|
+
vlc-client has been tested on linux but it should work on any VLC installation as long as the command line is responsive for `vlc` and `cvlc` calls. On Mac OSX these are not available by default. They can be created with:
|
94
94
|
|
95
95
|
```
|
96
96
|
ln -s /Applications/VLC.app/Contents/MacOS/VLC /usr/local/bin/vlc
|
data/lib/vlc-client.rb
CHANGED
@@ -24,6 +24,7 @@ module VLC
|
|
24
24
|
include VLC::Client::VideoControls
|
25
25
|
include VLC::Client::ConnectionManagement
|
26
26
|
|
27
|
+
attr_reader :connection
|
27
28
|
attr_accessor :host,
|
28
29
|
:port,
|
29
30
|
:server
|
@@ -69,8 +70,6 @@ module VLC
|
|
69
70
|
bind_server(server, options) unless server.nil?
|
70
71
|
end
|
71
72
|
|
72
|
-
attr_reader :connection
|
73
|
-
|
74
73
|
private
|
75
74
|
def bind_server(server, options = {})
|
76
75
|
@connection.host = server.host
|
data/lib/vlc-client/server.rb
CHANGED
@@ -45,9 +45,21 @@ module VLC
|
|
45
45
|
#
|
46
46
|
def start(detached = false)
|
47
47
|
return @pid if running?
|
48
|
-
rd, wr = IO.pipe
|
49
|
-
|
50
48
|
detached ? @deamon = true : setup_traps
|
49
|
+
|
50
|
+
if RUBY_VERSION >= '1.9'
|
51
|
+
@pid = Process.spawn(headless? ? 'cvlc' : 'vlc',
|
52
|
+
'--extraintf', 'rc', '--rc-host', "#{@host}:#{@port}",
|
53
|
+
:pgroup => detached,
|
54
|
+
:in => '/dev/null',
|
55
|
+
:out => '/dev/null',
|
56
|
+
:err => '/dev/null')
|
57
|
+
|
58
|
+
return @pid
|
59
|
+
end
|
60
|
+
|
61
|
+
# for Ruby 1.8 and below
|
62
|
+
rd, wr = IO.pipe
|
51
63
|
if Process.fork #parent
|
52
64
|
wr.close
|
53
65
|
@pid = rd.read.to_i
|
@@ -104,9 +116,20 @@ module VLC
|
|
104
116
|
|
105
117
|
private
|
106
118
|
def setup_traps
|
107
|
-
trap("EXIT")
|
108
|
-
|
109
|
-
|
119
|
+
trap("EXIT") do
|
120
|
+
stop
|
121
|
+
exit
|
122
|
+
end
|
123
|
+
|
124
|
+
trap("INT") do
|
125
|
+
stop
|
126
|
+
exit
|
127
|
+
end
|
128
|
+
|
129
|
+
trap("CLD") do
|
130
|
+
@pid = NullObject.new
|
131
|
+
@deamon = false
|
132
|
+
end
|
110
133
|
end
|
111
134
|
|
112
135
|
def detach
|
@@ -119,4 +142,4 @@ module VLC
|
|
119
142
|
end
|
120
143
|
end
|
121
144
|
end
|
122
|
-
end
|
145
|
+
end
|
data/lib/vlc-client/version.rb
CHANGED
data/spec/helper.rb
CHANGED
@@ -30,39 +30,21 @@ module Mocks
|
|
30
30
|
end
|
31
31
|
|
32
32
|
def mock_system_calls(opts = {})
|
33
|
-
if
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
else
|
41
|
-
Process.should_receive(:daemon).once
|
42
|
-
end
|
43
|
-
Process.should_receive(:pid).once.and_return(99)
|
44
|
-
|
45
|
-
rd = double('rd', :close => true)
|
46
|
-
wd = double('wd', :write => true, :close => true)
|
47
|
-
IO.stub(:pipe).and_return([rd, wd])
|
48
|
-
|
49
|
-
[STDIN, STDOUT, STDERR].each { |std| std.stub(:reopen) }
|
50
|
-
|
33
|
+
if RUBY_VERSION < "1.9"
|
34
|
+
# ruby 1.8.x system call stubs
|
35
|
+
rd = double('rd', :read => 99, :close => true)
|
36
|
+
wr = double('wr', :close => true)
|
37
|
+
IO.stub(:pipe).and_return([rd, wr])
|
38
|
+
Process.stub(:fork).twice.and_return(true)
|
39
|
+
Process.stub(:pid).once.and_return(99)
|
51
40
|
Kernel.stub(:exec)
|
41
|
+
[STDIN, STDOUT, STDERR].each { |std| std.stub(:reopen) }
|
52
42
|
else
|
53
|
-
|
54
|
-
|
55
|
-
rd = double('rd', :read => 99, :close => true)
|
56
|
-
wd = double('wd', :close => true)
|
57
|
-
IO.stub(:pipe).and_return([rd, wd])
|
58
|
-
|
59
|
-
Process.should_receive(:kill).once.with('INT', 99) if opts.fetch(:kill, true)
|
43
|
+
# ruby 1.9+ process spwan mock
|
44
|
+
Process.should_receive(:spawn).once.and_return(99)
|
60
45
|
end
|
61
|
-
end
|
62
46
|
|
63
|
-
|
64
|
-
mock_system_calls
|
65
|
-
mock_tcp_server
|
47
|
+
Process.should_receive(:kill).once.with('INT', 99) if opts.fetch(:kill, true)
|
66
48
|
end
|
67
49
|
|
68
50
|
def mock_file(filename)
|
@@ -76,4 +58,4 @@ end
|
|
76
58
|
|
77
59
|
RSpec.configure do |cfg|
|
78
60
|
cfg.include(Mocks)
|
79
|
-
end
|
61
|
+
end
|
data/spec/system_spec.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vlc-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miguel Guinada
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-01-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: retryable
|