muzak 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/muzak/config.rb +19 -19
- data/lib/muzak/const.rb +2 -1
- data/lib/muzak/instance.rb +2 -0
- data/lib/muzak/player/mpv.rb +4 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 555a55d7f9867d8948a8fc0833a82ac66a61bb06
|
4
|
+
data.tar.gz: 319b1a66cb87c53cd1d3b060a929ff143a59697d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3c4099bf08cba1bd7c06f2635ebe24733a0be6dd46b96f1764557ca2669f1ec880a04f8c27c358c8dc02143c753982c7072836b879e5f854bb99b132d3806e16
|
7
|
+
data.tar.gz: c74b01368740748f951acec9ae617d2a3d663b354b07f6b86e49b20dde90b41bc20b63c4b95fa2eb46242ce30d3fe1cb0125dc74c94c0ccc34cc96e6fc60a2e5
|
data/lib/muzak/config.rb
CHANGED
@@ -10,6 +10,25 @@ module Muzak
|
|
10
10
|
# Config.art_geometry # => "300x300"
|
11
11
|
# @see file:CONFIGURATION.md User Configuration
|
12
12
|
class Config
|
13
|
+
# Catches all undefined configuration keys and defaults them to false.
|
14
|
+
# @return [false]
|
15
|
+
def self.method_missing(method, *args)
|
16
|
+
false
|
17
|
+
end
|
18
|
+
|
19
|
+
# Synchronizes the in-memory configuration with {CONFIG_FILE}.
|
20
|
+
# @return [void]
|
21
|
+
def self.sync!
|
22
|
+
File.open(CONFIG_FILE, "w") { |io| io.write @config.to_yaml }
|
23
|
+
end
|
24
|
+
|
25
|
+
# @return [Boolean] whether or not the given plugin is configured
|
26
|
+
# @note the truth-value of this method is used to determine which
|
27
|
+
# plugins should be loaded.
|
28
|
+
def self.plugin?(pname)
|
29
|
+
respond_to? "plugin_#{pname}"
|
30
|
+
end
|
31
|
+
|
13
32
|
if File.exist?(CONFIG_FILE)
|
14
33
|
@config = YAML::load_file(CONFIG_FILE)
|
15
34
|
else
|
@@ -40,24 +59,5 @@ module Muzak
|
|
40
59
|
sync!
|
41
60
|
end
|
42
61
|
end
|
43
|
-
|
44
|
-
# Catches all undefined configuration keys and defaults them to false.
|
45
|
-
# @return [false]
|
46
|
-
def self.method_missing(method, *args)
|
47
|
-
false
|
48
|
-
end
|
49
|
-
|
50
|
-
# Synchronizes the in-memory configuration with {CONFIG_FILE}.
|
51
|
-
# @return [void]
|
52
|
-
def self.sync!
|
53
|
-
File.open(CONFIG_FILE, "w") { |io| io.write @config.to_yaml }
|
54
|
-
end
|
55
|
-
|
56
|
-
# @return [Boolean] whether or not the given plugin is configured
|
57
|
-
# @note the truth-value of this method is used to determine which
|
58
|
-
# plugins should be loaded.
|
59
|
-
def self.plugin?(pname)
|
60
|
-
respond_to? "plugin_#{pname}"
|
61
|
-
end
|
62
62
|
end
|
63
63
|
end
|
data/lib/muzak/const.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module Muzak
|
2
2
|
# Muzak's current version
|
3
|
-
VERSION = "0.1.
|
3
|
+
VERSION = "0.1.6".freeze
|
4
4
|
|
5
5
|
# The root directory for all user configuration, data, etc
|
6
6
|
CONFIG_DIR = File.expand_path("~/.config/muzak").freeze
|
@@ -23,6 +23,7 @@ module Muzak
|
|
23
23
|
|
24
24
|
# All events currently propagated by {Muzak::Instance#event}
|
25
25
|
PLUGIN_EVENTS = [
|
26
|
+
:instance_started,
|
26
27
|
:player_activated,
|
27
28
|
:player_deactivated,
|
28
29
|
:song_loaded,
|
data/lib/muzak/instance.rb
CHANGED
data/lib/muzak/player/mpv.rb
CHANGED
@@ -186,11 +186,11 @@ module Muzak
|
|
186
186
|
command "playlist-clear"
|
187
187
|
end
|
188
188
|
|
189
|
-
# Get mpv's currently
|
190
|
-
# @return [Song, nil] the currently
|
189
|
+
# Get mpv's currently loaded song.
|
190
|
+
# @return [Song, nil] the currently loaded song
|
191
191
|
def now_playing
|
192
|
-
|
193
|
-
|
192
|
+
path = get_property "path"
|
193
|
+
return if path&.empty?
|
194
194
|
@_now_playing ||= Song.new(get_property "path")
|
195
195
|
end
|
196
196
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: muzak
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- William Woodruff
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-01-
|
11
|
+
date: 2017-01-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: taglib-ruby
|