vlc-client 0.0.1.beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +21 -0
- data/.rspec +1 -0
- data/.travis.yml +10 -0
- data/.yardopts +2 -0
- data/Gemfile +4 -0
- data/LICENSE +22 -0
- data/README.md +108 -0
- data/Rakefile +40 -0
- data/lib/vlc-client.rb +102 -0
- data/lib/vlc-client/client/connection_management.rb +23 -0
- data/lib/vlc-client/client/media_controls.rb +98 -0
- data/lib/vlc-client/client/video_controls.rb +10 -0
- data/lib/vlc-client/connection.rb +77 -0
- data/lib/vlc-client/core_ext/array.rb +12 -0
- data/lib/vlc-client/errors.rb +16 -0
- data/lib/vlc-client/null_object.rb +24 -0
- data/lib/vlc-client/server.rb +73 -0
- data/lib/vlc-client/system.rb +58 -0
- data/lib/vlc-client/version.rb +3 -0
- data/spec/helper.rb +40 -0
- data/spec/system_spec.rb +31 -0
- data/spec/vlc-client/client/connection_management_spec.rb +24 -0
- data/spec/vlc-client/client/media_controls_spec.rb +188 -0
- data/spec/vlc-client/client/video_controls_spec.rb +13 -0
- data/spec/vlc-client/connection_spec.rb +70 -0
- data/spec/vlc-client/server_spec.rb +19 -0
- data/spec/vlc_client_spec.rb +42 -0
- data/vlc.gemspec +29 -0
- metadata +159 -0
@@ -0,0 +1,13 @@
|
|
1
|
+
describe VLC::Client::VideoControls do
|
2
|
+
let(:vlc) { VLC::Client.new(:self_managed => false) }
|
3
|
+
after(:each) { vlc.disconnect }
|
4
|
+
|
5
|
+
context 'manipulate the screen size' do
|
6
|
+
it 'toggles fullscreen' do
|
7
|
+
mock_tcp_server.should_receive(:puts).once.with('fullscreen')
|
8
|
+
|
9
|
+
vlc.connect
|
10
|
+
vlc.fullscreen
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
describe VLC::Connection do
|
2
|
+
after(:each) { connection.disconnect }
|
3
|
+
let(:connection) { VLC::Connection.new('localhost', 9595) }
|
4
|
+
|
5
|
+
context 'when disconnected' do
|
6
|
+
it 'connects to VLC server' do
|
7
|
+
mock_tcp_server
|
8
|
+
|
9
|
+
connection.connect
|
10
|
+
connection.should be_connected
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'connection failure raises error' do
|
14
|
+
TCPSocket.should_receive(:new).and_raise(Errno::ECONNREFUSED)
|
15
|
+
expect { connection.connect }.to raise_error(VLC::ConnectionRefused)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
context 'when connected' do
|
20
|
+
it 'disconnects from a VLC server' do
|
21
|
+
mock_tcp_server
|
22
|
+
connection.connect
|
23
|
+
|
24
|
+
connection.disconnect
|
25
|
+
connection.should_not be_connected
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'writes data to server' do
|
29
|
+
mock_tcp_server.should_receive(:puts).once.with('some data')
|
30
|
+
|
31
|
+
connection.connect
|
32
|
+
connection.write('some data')
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'reads data from server' do
|
36
|
+
tcp = mock_tcp_server
|
37
|
+
tcp.should_receive(:puts).once.with('some data')
|
38
|
+
tcp.should_receive(:gets).once.and_return('some response data')
|
39
|
+
|
40
|
+
connection.connect
|
41
|
+
connection.write('some data', false)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
context 'raises error on' do
|
46
|
+
it 'unreadable content' do
|
47
|
+
tcp = mock_tcp_server
|
48
|
+
tcp.should_receive(:puts).once.with('some data')
|
49
|
+
tcp.should_receive(:gets).once.and_return('some response data')
|
50
|
+
|
51
|
+
connection.connect
|
52
|
+
connection.should_receive(:process_data).once.and_return(nil)
|
53
|
+
|
54
|
+
expect { connection.write('some data', false) }.to raise_error(VLC::ProtocolError)
|
55
|
+
end
|
56
|
+
|
57
|
+
it 'broken pipe' do
|
58
|
+
mock_tcp_server.should_receive(:puts).with('something').and_raise(Errno::EPIPE)
|
59
|
+
|
60
|
+
connection.connect
|
61
|
+
expect { connection.write('something') }.to raise_error(VLC::BrokenConnectionError)
|
62
|
+
connection.should_not be_connected
|
63
|
+
end
|
64
|
+
|
65
|
+
it 'write on a disconnected connection' do
|
66
|
+
connection.stub(:connected?).and_return(false)
|
67
|
+
expect { connection.write('something') }.to raise_error(VLC::NotConnectedError)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
describe VLC::Server do
|
2
|
+
let!(:server) do
|
3
|
+
mock_system_calls
|
4
|
+
server = VLC::Server.new('localhost', 9595, true)
|
5
|
+
end
|
6
|
+
after(:each) { server.stop }
|
7
|
+
|
8
|
+
it 'starts a VLC instance' do
|
9
|
+
server.start.should_not be_nil
|
10
|
+
server.should be_running
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'stops a VLC instance' do
|
14
|
+
server.start
|
15
|
+
|
16
|
+
server.stop.should_not be_nil
|
17
|
+
server.should_not be_running
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
describe VLC::Client do
|
2
|
+
context 'initialization' do
|
3
|
+
before(:each) { mock_tcp_server(:close => false) }
|
4
|
+
|
5
|
+
it 'connects to a VLC server' do
|
6
|
+
vlc = VLC::Client.new
|
7
|
+
vlc.connect
|
8
|
+
vlc.should be_connected
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'receives host and port' do
|
12
|
+
vlc = VLC::Client.new('10.0.0.1', 9999)
|
13
|
+
vlc.host.should eq('10.0.0.1')
|
14
|
+
vlc.port.should eq(9999)
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'is self managed if server is given' do
|
18
|
+
mock_system_calls(:kill => false)
|
19
|
+
|
20
|
+
vlc = VLC::Client.new(VLC::Server.new('10.0.0.1', 9999))
|
21
|
+
vlc.server.should be_started
|
22
|
+
vlc.should be_connected
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'may handle lifecycle management to client code' do
|
26
|
+
vlc = VLC::Client.new(VLC::Server.new('10.0.0.1', 9999), :auto_start => false)
|
27
|
+
vlc.server.should_not be_started
|
28
|
+
vlc.should_not be_connected
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'may manage an embedded VLC server' do
|
33
|
+
mock_tcp_server(:close => false)
|
34
|
+
mock_system_calls(:kill => false)
|
35
|
+
VLC::Client.new(VLC::Server.new).server.should be_a(VLC::Server)
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'is configurable' do
|
39
|
+
vlc = VLC::Client.new(VLC::Server.new, :auto_start => false)
|
40
|
+
vlc.server.should_not be_started
|
41
|
+
end
|
42
|
+
end
|
data/vlc.gemspec
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/vlc-client/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.authors = ["Miguel Guinada"]
|
6
|
+
gem.email = ["mguinada@gmail.com"]
|
7
|
+
gem.description = %q{vlc-client allows to control VLC media player over TCP}
|
8
|
+
gem.summary = %q{vlc-client is a TCP client for VLC media player}
|
9
|
+
gem.homepage = "https://github.com/mguinada/vlc-client"
|
10
|
+
|
11
|
+
gem.files = `git ls-files`.split($\)
|
12
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
13
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
14
|
+
gem.name = "vlc-client"
|
15
|
+
gem.require_paths = ["lib"]
|
16
|
+
gem.version = VLC::VERSION
|
17
|
+
gem.date = Time.now.utc.strftime("%Y-%m-%d")
|
18
|
+
|
19
|
+
#package
|
20
|
+
gem.add_dependency 'retryable', '~> 1.3'
|
21
|
+
|
22
|
+
#development
|
23
|
+
gem.add_development_dependency 'rake'
|
24
|
+
gem.add_development_dependency 'rspec'
|
25
|
+
gem.add_development_dependency 'simplecov'
|
26
|
+
gem.add_development_dependency 'pry'
|
27
|
+
gem.add_development_dependency 'yard'
|
28
|
+
gem.add_development_dependency 'maruku'
|
29
|
+
end
|
metadata
ADDED
@@ -0,0 +1,159 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: vlc-client
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1.beta
|
5
|
+
prerelease: 6
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Miguel Guinada
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-10-28 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: retryable
|
16
|
+
requirement: &16536620 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '1.3'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *16536620
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: rake
|
27
|
+
requirement: &16535440 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
type: :development
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *16535440
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: rspec
|
38
|
+
requirement: &16534580 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
type: :development
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *16534580
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: simplecov
|
49
|
+
requirement: &16533480 !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
type: :development
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: *16533480
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: pry
|
60
|
+
requirement: &16532400 !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
62
|
+
requirements:
|
63
|
+
- - ! '>='
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '0'
|
66
|
+
type: :development
|
67
|
+
prerelease: false
|
68
|
+
version_requirements: *16532400
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: yard
|
71
|
+
requirement: &16531440 !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
73
|
+
requirements:
|
74
|
+
- - ! '>='
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
type: :development
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: *16531440
|
80
|
+
- !ruby/object:Gem::Dependency
|
81
|
+
name: maruku
|
82
|
+
requirement: &16515700 !ruby/object:Gem::Requirement
|
83
|
+
none: false
|
84
|
+
requirements:
|
85
|
+
- - ! '>='
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '0'
|
88
|
+
type: :development
|
89
|
+
prerelease: false
|
90
|
+
version_requirements: *16515700
|
91
|
+
description: vlc-client allows to control VLC media player over TCP
|
92
|
+
email:
|
93
|
+
- mguinada@gmail.com
|
94
|
+
executables: []
|
95
|
+
extensions: []
|
96
|
+
extra_rdoc_files: []
|
97
|
+
files:
|
98
|
+
- .gitignore
|
99
|
+
- .rspec
|
100
|
+
- .travis.yml
|
101
|
+
- .yardopts
|
102
|
+
- Gemfile
|
103
|
+
- LICENSE
|
104
|
+
- README.md
|
105
|
+
- Rakefile
|
106
|
+
- lib/vlc-client.rb
|
107
|
+
- lib/vlc-client/client/connection_management.rb
|
108
|
+
- lib/vlc-client/client/media_controls.rb
|
109
|
+
- lib/vlc-client/client/video_controls.rb
|
110
|
+
- lib/vlc-client/connection.rb
|
111
|
+
- lib/vlc-client/core_ext/array.rb
|
112
|
+
- lib/vlc-client/errors.rb
|
113
|
+
- lib/vlc-client/null_object.rb
|
114
|
+
- lib/vlc-client/server.rb
|
115
|
+
- lib/vlc-client/system.rb
|
116
|
+
- lib/vlc-client/version.rb
|
117
|
+
- spec/helper.rb
|
118
|
+
- spec/system_spec.rb
|
119
|
+
- spec/vlc-client/client/connection_management_spec.rb
|
120
|
+
- spec/vlc-client/client/media_controls_spec.rb
|
121
|
+
- spec/vlc-client/client/video_controls_spec.rb
|
122
|
+
- spec/vlc-client/connection_spec.rb
|
123
|
+
- spec/vlc-client/server_spec.rb
|
124
|
+
- spec/vlc_client_spec.rb
|
125
|
+
- vlc.gemspec
|
126
|
+
homepage: https://github.com/mguinada/vlc-client
|
127
|
+
licenses: []
|
128
|
+
post_install_message:
|
129
|
+
rdoc_options: []
|
130
|
+
require_paths:
|
131
|
+
- lib
|
132
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
133
|
+
none: false
|
134
|
+
requirements:
|
135
|
+
- - ! '>='
|
136
|
+
- !ruby/object:Gem::Version
|
137
|
+
version: '0'
|
138
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
139
|
+
none: false
|
140
|
+
requirements:
|
141
|
+
- - ! '>'
|
142
|
+
- !ruby/object:Gem::Version
|
143
|
+
version: 1.3.1
|
144
|
+
requirements: []
|
145
|
+
rubyforge_project:
|
146
|
+
rubygems_version: 1.8.15
|
147
|
+
signing_key:
|
148
|
+
specification_version: 3
|
149
|
+
summary: vlc-client is a TCP client for VLC media player
|
150
|
+
test_files:
|
151
|
+
- spec/helper.rb
|
152
|
+
- spec/system_spec.rb
|
153
|
+
- spec/vlc-client/client/connection_management_spec.rb
|
154
|
+
- spec/vlc-client/client/media_controls_spec.rb
|
155
|
+
- spec/vlc-client/client/video_controls_spec.rb
|
156
|
+
- spec/vlc-client/connection_spec.rb
|
157
|
+
- spec/vlc-client/server_spec.rb
|
158
|
+
- spec/vlc_client_spec.rb
|
159
|
+
has_rdoc:
|