mvlc 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mvlc.rb +1 -1
- data/lib/mvlc/player/wrapper.rb +11 -4
- data/test/player/wrapper_test.rb +3 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c8fcc7d1463e23552cf7cdb42fed336baa2924da
|
4
|
+
data.tar.gz: ec3be17ea4995f47383f41d06288eb776652c484
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5741c4c5d7bf0ba8f8fccb4738c3f1968328dd16a6f29b0e36e44e5c67fa4f29e7747dac9f23a0a5e7a54456f6b84d89df3878bf4c00544cc57fbdecc423ac5c
|
7
|
+
data.tar.gz: 81dfa6df1aaafe596d59cbdbfd15a177bf4879dd2152f942c04bd70f31b1ea2ae09444a6bc904665a886fa97e305656b2ba2809b32531e185d3256bfbd09772b
|
data/lib/mvlc.rb
CHANGED
data/lib/mvlc/player/wrapper.rb
CHANGED
@@ -27,7 +27,7 @@ module MVLC
|
|
27
27
|
length_in_seconds = @player.length
|
28
28
|
seconds = length_in_seconds * (percent / 100.0)
|
29
29
|
@player.seek(seconds)
|
30
|
-
rescue VLC::ReadTimeoutError
|
30
|
+
rescue VLC::ReadTimeoutError, VLC::BrokenConnectionError
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
@@ -87,8 +87,7 @@ module MVLC
|
|
87
87
|
# Cause MPlayer to exit
|
88
88
|
# @return [Boolean]
|
89
89
|
def quit
|
90
|
-
@player.
|
91
|
-
@player.connection.write("logout")
|
90
|
+
@player.server.stop
|
92
91
|
true
|
93
92
|
end
|
94
93
|
|
@@ -136,10 +135,18 @@ module MVLC
|
|
136
135
|
@state.handle_start
|
137
136
|
end
|
138
137
|
|
138
|
+
def playing?
|
139
|
+
begin
|
140
|
+
@player.playing?
|
141
|
+
rescue VLC::ReadTimeoutError, VLC::BrokenConnectionError
|
142
|
+
false
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
139
146
|
# Has the end of a media file been reached?
|
140
147
|
# @return [Boolean]
|
141
148
|
def eof?
|
142
|
-
@state.eof_reached? &&
|
149
|
+
@state.eof_reached? && !playing?
|
143
150
|
end
|
144
151
|
|
145
152
|
end
|
data/test/player/wrapper_test.rb
CHANGED
@@ -7,6 +7,9 @@ class MVLC::Player::WrapperTest < Minitest::Test
|
|
7
7
|
setup do
|
8
8
|
@player = Object.new
|
9
9
|
@player.stubs(:quit)
|
10
|
+
conn = Object.new
|
11
|
+
conn.stubs(:write)
|
12
|
+
@player.stubs(:connection).returns(conn)
|
10
13
|
VLC::System.stubs(:new).returns(@player)
|
11
14
|
@player = MVLC::Player::Wrapper.new
|
12
15
|
end
|
@@ -41,7 +44,6 @@ class MVLC::Player::WrapperTest < Minitest::Test
|
|
41
44
|
|
42
45
|
should "lazily invoke mplayer and play" do
|
43
46
|
assert @player.play("file.mov")
|
44
|
-
#refute_nil @player.instance_variable_get("@player")
|
45
47
|
end
|
46
48
|
|
47
49
|
end
|