muzak 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/muzak.rb +1 -1
  3. data/lib/muzak/player/vlc.rb +5 -24
  4. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a2c396ccd25b5ca8dad7e33aad87e5e6f277f82f
4
- data.tar.gz: 28f0518d153ca7dffa8713884a481b583ccdbdbb
3
+ metadata.gz: db204b0d9f256751a68fa9cb597ed3473d4a87ec
4
+ data.tar.gz: 7008b0cdffc2b98ccaedacaa7a5ca01eb23bbbf1
5
5
  SHA512:
6
- metadata.gz: 7619e9fec7c0413fadbd240c3abc828cef121aa8e9f34ba0a1c504750c31171a29aa0c43f18fdbac8d99de2ed68815db88266852ddaf0ed353dd525ee53f598a
7
- data.tar.gz: a3b2b9fa7d6606a4d1f081878034890358fe97b763bcc8816365bf7cd24690905414631754c39450b1aca3d01aabe45792daa40eb0ef2a7978022effe5a045e3
6
+ metadata.gz: f333cb37e5e8f88082fdb693dd4dfdb3055ecbc84f6d56b976c5f5c0575f5135ad63c596b4fe113074a8d172b8f0de5ccc2ed3d82b24deb74bbc32585a16138d
7
+ data.tar.gz: 3b3da27b4177a24104bf88df29cfbbc04e235b611a8ed2adcaffc7c1c4a51f964a4d802ca13c30fa597ac9809b7812024e01338cba0e00c4170ab97f55e5f99e
@@ -12,5 +12,5 @@ require_relative "muzak/instance"
12
12
  # The primary namespace for muzak.
13
13
  module Muzak
14
14
  # Muzak's current version
15
- VERSION = "0.3.1".freeze
15
+ VERSION = "0.3.2".freeze
16
16
  end
@@ -4,18 +4,6 @@ module Muzak
4
4
  module Player
5
5
  # Exposes a VLC process to muzak for playback control.
6
6
  class VLC < StubPlayer
7
- # The expression used to extract the filename out of {#status}
8
- # @api private
9
- INPUT_REGEX = /\( new input: file:\/\/(.*) \)/.freeze
10
-
11
- # The expression used to extract the volume out of {#status}
12
- # @api private
13
- VOLUME_REGEX = /\( audio volume: (\d+) \)/.freeze
14
-
15
- # The expression used to extract the playing status out of {#status}
16
- # @api private
17
- PLAYING_REGEX = /\( state (.*) \)/.freeze
18
-
19
7
  # @return [Boolean] whether or not VLC is available
20
8
  def self.available?
21
9
  Utils.which?("vlc") && Utils.which?("cvlc")
@@ -68,6 +56,8 @@ module Muzak
68
56
 
69
57
  # @return [Boolean] whether or not VLC is currently playing.
70
58
  def playing?
59
+ return false unless running?
60
+
71
61
  @vlc.playing?
72
62
  end
73
63
 
@@ -146,8 +136,9 @@ module Muzak
146
136
  # Get VLC's currently loaded song.
147
137
  # @return [Song, nil] the currently loaded song
148
138
  def now_playing
149
- filename = INPUT_REGEX.match(status.first)[1]
150
- Song.new(filename)
139
+ return unless playing?
140
+
141
+ Song.new(@vlc.status[:file])
151
142
  end
152
143
 
153
144
  # Load a song into VLC.
@@ -158,16 +149,6 @@ module Muzak
158
149
  @vlc.add_to_playlist song.path
159
150
  @vlc.play if Config.autoplay
160
151
  end
161
-
162
- # Get VLC's status.
163
- # @return [Array<String>] the loaded file, volume, and playing statuses
164
- # @api private
165
- # @note The strings returned by this method can be handled via
166
- # {INPUT_REGEX}, {VOLUME_REGEX}, and {PLAYING_REGEX}.
167
- def status
168
- @vlc.connection.write "status"
169
- 3.times.collect { @vlc.connection.read }
170
- end
171
152
  end
172
153
  end
173
154
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: muzak
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Woodruff
@@ -50,14 +50,14 @@ dependencies:
50
50
  requirements:
51
51
  - - "~>"
52
52
  - !ruby/object:Gem::Version
53
- version: 0.0.6
53
+ version: 0.0.7
54
54
  type: :runtime
55
55
  prerelease: false
56
56
  version_requirements: !ruby/object:Gem::Requirement
57
57
  requirements:
58
58
  - - "~>"
59
59
  - !ruby/object:Gem::Version
60
- version: 0.0.6
60
+ version: 0.0.7
61
61
  description: A library for controlling playlists and media players.
62
62
  email: william@tuffbizz.com
63
63
  executables: