muzak 0.3.1 → 0.3.2
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 +4 -4
- data/lib/muzak.rb +1 -1
- data/lib/muzak/player/vlc.rb +5 -24
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: db204b0d9f256751a68fa9cb597ed3473d4a87ec
|
4
|
+
data.tar.gz: 7008b0cdffc2b98ccaedacaa7a5ca01eb23bbbf1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f333cb37e5e8f88082fdb693dd4dfdb3055ecbc84f6d56b976c5f5c0575f5135ad63c596b4fe113074a8d172b8f0de5ccc2ed3d82b24deb74bbc32585a16138d
|
7
|
+
data.tar.gz: 3b3da27b4177a24104bf88df29cfbbc04e235b611a8ed2adcaffc7c1c4a51f964a4d802ca13c30fa597ac9809b7812024e01338cba0e00c4170ab97f55e5f99e
|
data/lib/muzak.rb
CHANGED
data/lib/muzak/player/vlc.rb
CHANGED
@@ -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
|
-
|
150
|
-
|
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.
|
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.
|
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.
|
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:
|