muzak 0.1.7 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/muzakd +1 -2
- data/lib/muzak/config.rb +19 -10
- data/lib/muzak/const.rb +1 -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: 3343a7ac9f6f6902736580ca2dc6d83821ccbdb8
|
4
|
+
data.tar.gz: 6e4ae9b75369dbdee0f1f3c3b74c970689c68ed8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a00938c127bc0458f8055ed5f8519bb3e17f165665744fb71f1ba7b668db270387016c68e16ceddc9fdfde8b347eb05236c525daa650e245e6cdabf937c66716
|
7
|
+
data.tar.gz: eb1c7eb8fb51521d7fed514915f4af1890ab1eab39b18af6810ae7167c0e1524790132bf7ffa489f367a2b074ff11b2f3998a7619340f27ed1a9a57b32e8e95f
|
data/bin/muzakd
CHANGED
@@ -11,8 +11,7 @@ Thread.abort_on_exception = Muzak::Config.debug
|
|
11
11
|
|
12
12
|
muzak = Muzak::Instance.new
|
13
13
|
|
14
|
-
|
15
|
-
server = TCPServer.new server_port
|
14
|
+
server = TCPServer.new Muzak::Config.daemon_port
|
16
15
|
|
17
16
|
loop do
|
18
17
|
Thread.new(server.accept) do |client|
|
data/lib/muzak/config.rb
CHANGED
@@ -29,18 +29,25 @@ module Muzak
|
|
29
29
|
respond_to? "plugin_#{pname}"
|
30
30
|
end
|
31
31
|
|
32
|
+
DEFAULT_CONFIG = {
|
33
|
+
# core defaults
|
34
|
+
"debug" => false,
|
35
|
+
"verbose" => true,
|
36
|
+
"music" => File.expand_path("~/music"),
|
37
|
+
"player" => "mpv",
|
38
|
+
"index-autobuild" => 86400,
|
39
|
+
"deep-index" => false,
|
40
|
+
"jukebox-size" => 100,
|
41
|
+
|
42
|
+
# client/daemon defaults
|
43
|
+
"daemon-port" => 2669,
|
44
|
+
"daemon-host" => "localhost",
|
45
|
+
}.freeze
|
46
|
+
|
32
47
|
if File.exist?(CONFIG_FILE)
|
33
|
-
|
48
|
+
user_config = YAML::load_file(CONFIG_FILE)
|
34
49
|
else
|
35
|
-
|
36
|
-
"debug" => false,
|
37
|
-
"verbose" => true,
|
38
|
-
"music" => File.expand_path("~/music"),
|
39
|
-
"player" => "mpv",
|
40
|
-
"index-autobuild" => 86400,
|
41
|
-
"deep-index" => false,
|
42
|
-
"jukebox-size" => 100
|
43
|
-
}
|
50
|
+
user_config = DEFAULT_CONFIG
|
44
51
|
|
45
52
|
[CONFIG_DIR, PLAYLIST_DIR, USER_PLUGIN_DIR, USER_COMMAND_DIR].each do |d|
|
46
53
|
FileUtils.mkdir_p d
|
@@ -49,6 +56,8 @@ module Muzak
|
|
49
56
|
sync!
|
50
57
|
end
|
51
58
|
|
59
|
+
@config = DEFAULT_CONFIG.merge(user_config)
|
60
|
+
|
52
61
|
@config.each do |key, _|
|
53
62
|
define_singleton_method Utils.resolve_command(key) do
|
54
63
|
@config[key]
|
data/lib/muzak/const.rb
CHANGED