vlc-client 0.0.6 → 0.0.7

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b141e2f7f60baf5ac577461081fbaade9ff4c051
4
- data.tar.gz: d7d66afcdf65b58fc266413eaa4a286e312ff846
3
+ metadata.gz: 9147dc5e6a15d08a05df809ff663b6742745c74d
4
+ data.tar.gz: c17e805e48164003a0e41799bc76fbb0929932e3
5
5
  SHA512:
6
- metadata.gz: 73fcaa9d7b0bf70fe306e30b31a1559d3ed298fbfbee48d5577dd1fcd1ef3b0fe19e192bc63635c640132ce226417856d50fa984ad630a06234e4d70dc4757ce
7
- data.tar.gz: 92c826484688bd0265ff2eaecf7f34c0c72f921fc0653a7ce34630b30b622314c08e4b3ddf49ed23252b6f516b9b625a9672b1d4939cd05e7e65bd089ddfd2e9
6
+ metadata.gz: 32ae8d3654604c60d1fada63aae4c5d6700227cfbace78a6e4b41157804267ec9f3d890de13973fc126f2ac4dd2d85b8b91aaf18d523d26c0055a863d2259449
7
+ data.tar.gz: 51fa0cc8e26e35f876158bde6e8b2a25f216cfa915c566f74652fbfdd3961ee53c642bfb1301104dba7e9e311b156d9a2fecbdce302ab6e7b2e1098d6d37d6b4
@@ -6,6 +6,7 @@ bundler_args: --without development
6
6
  matrix:
7
7
  allow_failures:
8
8
  - rvm: ruby-head
9
+ - rvm: rbx-2
9
10
  rvm:
10
11
  - jruby
11
12
  - rbx-2
@@ -13,5 +14,7 @@ rvm:
13
14
  - 2.0.0
14
15
  - 2.1.0
15
16
  - 2.2.0
17
+ - 2.3.3
18
+ - 2.4.0
16
19
  - ruby-head
17
20
 
data/Gemfile CHANGED
@@ -1,6 +1,6 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- gem 'rake'
3
+ gem 'rake', '< 11.0'
4
4
 
5
5
  group :development do
6
6
  gem 'guard-rspec', '~> 2.5.1'
@@ -3,6 +3,14 @@ require 'uri'
3
3
  module VLC
4
4
  class Client
5
5
  module MediaControls
6
+ # Expressions for parsing VLC's "status" command
7
+ # @api private
8
+ STATUS_MAPPING = {
9
+ file: /\( new input: file:\/\/(.*) \)/,
10
+ volume: /\( audio volume: (\d+) \)/,
11
+ state: /\( state (.*) \)/ ,
12
+ }.freeze
13
+
6
14
  # Plays media or resumes playback
7
15
  #
8
16
  # @overload play(media)
@@ -105,6 +113,21 @@ module VLC
105
113
  def volume=(level)
106
114
  volume(level)
107
115
  end
116
+
117
+ # @return [Hash{Symbol => String}] the mapping of status strings
118
+ # @example
119
+ # status = vlc.status
120
+ # status[:file] # => "/path/to/file/playing.mp3"
121
+ # status[:volume] # => "256"
122
+ # status[:state] # => "playing"
123
+ def status
124
+ connection.write("status")
125
+ raw_status = 3.times.collect { connection.read }
126
+
127
+ STATUS_MAPPING.keys.zip(raw_status).map do |k, s|
128
+ [k, STATUS_MAPPING[k].match(s)[1]]
129
+ end.to_h
130
+ end
108
131
  end
109
132
  end
110
133
  end
@@ -1,3 +1,3 @@
1
1
  module VLC
2
- VERSION = '0.0.6'
2
+ VERSION = '0.0.7'
3
3
  end
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.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miguel Guinada
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-03 00:00:00.000000000 Z
11
+ date: 2017-01-23 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: vlc-client allows to control VLC media player over TCP
14
14
  email: