muzak 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3bbc4c6526a315ebd1d0c6cb7dd3edf77809d7ae
4
- data.tar.gz: 21ac18f09286fd7ba229081247d17ef7311fd881
3
+ metadata.gz: 38d02c02227daac78a8a7d7b7aa219c99bec2843
4
+ data.tar.gz: 993d13e33b8484b6fb8053231e2015c0268c5d47
5
5
  SHA512:
6
- metadata.gz: e12366f7b35680c4c46dbcb2067bc1a65e4bf7472b160cc693114d0be26e9e68a4c874d1b1c6ae29ec920d2df6549c7650841bf04e33a8ce37ff1355c8f03a2d
7
- data.tar.gz: 28b3ab33bd145f695c2c433e3120da0903237fe8c76607cf543eebb2570f88cac1e325d7e146d3437a17c8d17fc55754c38da58b7bdda841d5c16a63072cd55d
6
+ metadata.gz: 3394c2f9f00ffbb1fb3ecaeca71a29544690bbb743dacd89bbf7d3faca7329623e4cf7574c42cbf68e1970dd9a77f03971a0429383bb1d4676387b719f333b9a
7
+ data.tar.gz: e7872463a13c5997c9521e1bf65e3a456a64678309836d3834ac47f3c57819cd60c9be69de7c858af43ba25fffd187714545dcfdfaf1d9862d51aeea5bf3ab97
data/.yardopts CHANGED
@@ -1 +1 @@
1
- --tag command:"muzak command" --tag cmdexample:"example invocation" --no-private --markup-provider=redcarpet --markup=markdown - README.md COMMANDS.md LICENSE
1
+ --tag command:"muzak command" --tag cmdexample:"example invocation" --no-private --markup-provider=redcarpet --markup=markdown - *.md LICENSE
@@ -0,0 +1,213 @@
1
+ Muzak configuration
2
+ ===================
3
+
4
+ This is the user-facing documentation for muzak's configuration.
5
+
6
+ For the developer documentation, see {Muzak::Config}.
7
+
8
+ ## General behavior
9
+
10
+ All of muzak's configuration is kept in {Muzak::Config}, which is read
11
+ during load-time (i.e., during `require`) from {Muzak::CONFIG_FILE}, which
12
+ is YAML-formatted.
13
+
14
+ Muzak loads configuration keys just like commands, translating them from
15
+ `kebab-case` to `snake_case`. For example, take the following configuration:
16
+
17
+ ```yaml
18
+ ---
19
+ debug: true
20
+ verbose: true
21
+ music: "/home/william/mnt/fortuna/music/"
22
+ player: mpv
23
+ art-geometry: 300x300
24
+ jukebox-size: 100
25
+ deep-index: true
26
+ ```
27
+
28
+ This is exposed in `Muzak::Config` as follows:
29
+
30
+ ```ruby
31
+ Muzak::Config.debug # => true
32
+ Muzak::Config.verbose # => true
33
+ Muzak::Config.music # => "/home/william/mnt/fortuna/music/"
34
+ Muzak::Config.player # => "mpv"
35
+ Muzak::Config.art_geometry # => "300x300"
36
+ Muzak::Config.jukebox_size # => 100
37
+ Muzak::Config.deep_index # => true
38
+ ```
39
+
40
+ Since {Muzak::Config} is populated whenever `muzak` is loaded via `require`,
41
+ it can be used within both scripts and clients. As such, it should be preferred
42
+ over custom configuration solutions for external programs that interact
43
+ primarily with muzak.
44
+
45
+ {Muzak::Config} resolves undefined keys to `false`, allowing a pattern like
46
+ this:
47
+
48
+ ```ruby
49
+ something_special Config.special_key if Config.special_key
50
+ ```
51
+
52
+ ## A note on plugin configuration
53
+
54
+ Muzak loads a plugin if and only if `plugin-$name` is present in the
55
+ configuration, where `$name` is the lowercased class name of the plugin
56
+ (see {Muzak::Plugin::StubPlugin.plugin_name} and {Muzak::Config.plugin?}).
57
+
58
+ For example, to enable the made-up "foo" plugin, your configuration should
59
+ include something like this.
60
+
61
+ ```
62
+ plugin-foo:
63
+ foo-option-1: bar
64
+ foo-option-2: baz
65
+ ```
66
+
67
+ Plugins can, of course, access their configuration through {Muzak::Config}:
68
+
69
+ ```
70
+ Muzak::Config.plugin_foo["foo-option-1"] # => "bar"
71
+ ```
72
+
73
+ ## Core configuration
74
+
75
+ These are the configuration keys observed by muzak's "core," particularly
76
+ {Muzak::Instance} any everything it controls.
77
+
78
+ In no particular order:
79
+
80
+ ### `debug`
81
+
82
+ *Optional.*
83
+
84
+ *Default:* `false`
85
+
86
+ If `debug: true` is set in the configuration file, then muzak operates in
87
+ debugging mode. This includes printing debug messages and not forking `muzakd`
88
+ into the background.
89
+
90
+ ### `verbose`
91
+
92
+ *Optional.*
93
+
94
+ *Default:* `true`
95
+
96
+ If `verbose: true` is set in the configuration file, then muzak operates in
97
+ verbose mode. This includes printing informational messages and not forking
98
+ `muzakd` into the background.
99
+
100
+ ### `music`
101
+
102
+ *Mandatory.*
103
+
104
+ *Default:* `~/music`
105
+
106
+ `music: <directory>` should be set to the directory of the music library.
107
+ Muzak uses this key to point the indexer at the correct directory.
108
+
109
+ ### `player`
110
+
111
+ *Mandatory.*
112
+
113
+ *Default:* `mpv`
114
+
115
+ `player: <player>` should be set to the short name of the user's music player.
116
+ Muzak uses this key to find the correct {Muzak::Player} underclass to
117
+ initialize and control.
118
+
119
+ The short names of supported players can be found in
120
+ {Muzak::Player::PLAYER_MAP}.
121
+
122
+ ### `index-autobuild`
123
+
124
+ *Optional.*
125
+
126
+ *Default:* `86400`
127
+
128
+ `index-autobuild: <span>` should be set to maximum number of seconds before
129
+ an index is considered outdated (based on its {Muzak::Index#timestamp} field).
130
+
131
+ When an outdated index is loaded and this key is set, muzak will automatically
132
+ rebuild the index.
133
+
134
+ **Note:** This is *not* an interval - the outdated index is only rebuilt
135
+ when a new {Muzak::Instance} or {Muzak::Index} is instantiated.
136
+
137
+ ### `deep-index`
138
+
139
+ *Optional.*
140
+
141
+ *Default:* `false`
142
+
143
+ If `deep-index: true` is set in the configuration file, then muzak will
144
+ build a "deep" index. This involves opening each music file and reading metadata
145
+ from it, which can take substantially longer than just a shallow filesystem
146
+ index.
147
+
148
+ This primary benefit of this is caching - having all the song metadata in the
149
+ index allows muzak to make fewer disk accesses, which may be expensive over
150
+ a remote disk.
151
+
152
+ ### `jukebox-size`
153
+
154
+ *Mandatory.*
155
+
156
+ *Default:* `100`
157
+
158
+ `jukebox-size: <size>` should be set to the number of random songs to enqueue
159
+ by default with the `jukebox` size.
160
+
161
+ ### `art-geometry`
162
+
163
+ *Optional.*
164
+
165
+ *No default.*
166
+
167
+ `art-geometry: <geometry>` should be set to the desired size of displayed
168
+ album art, in "WxH" format. If not set, album art will be displayed at
169
+ any size the player pleases.
170
+
171
+ It's entirely up to the user's player to obey this value.
172
+
173
+ ### `autoplay`
174
+
175
+ *Optional.*
176
+
177
+ *No default.*
178
+
179
+ `autoplay: <playlist>` should be set to a playlist that the user wishes to
180
+ automatically start when muzak starts. If not set, no playlist is automatically
181
+ played.
182
+
183
+ ## Daemon/client configuration
184
+
185
+ These are configuration keys observed by muzak's interface(s).
186
+
187
+ ### `daemon-port`
188
+
189
+ *Optional.*
190
+
191
+ *Default:* `2669`
192
+
193
+ `daemon-port: <port>` should be set to a valid port number for `muzakd` to
194
+ listen on.
195
+
196
+ ### `daemon-host`
197
+
198
+ *Optional.*
199
+
200
+ *Default:* `localhost`
201
+
202
+ `daemon-host: <hostname>` should be set to the hostname for `muzakd` to
203
+ listen on.
204
+
205
+ ### `dmenu-exec`
206
+
207
+ *Optional.*
208
+
209
+ *No default.*
210
+
211
+ `dmenu-exec: <command args...>` can be used to alter `muzak-dmenu`'s
212
+ invocation of `dmenu`. It can also be used to substitute a dmenu-compatible
213
+ prompt like `rofi -dmenu`.
data/README.md CHANGED
@@ -1,10 +1,12 @@
1
1
  muzak
2
2
  =====
3
3
 
4
+ [![Gem Version](https://badge.fury.io/rb/muzak.svg)](https://badge.fury.io/rb/muzak)
5
+
4
6
  muzak is an attempt at a metamusic player.
5
7
 
6
8
  It indexes a filesystem tree, providing metadata to a user's preferred media
7
- player. It also provides a pseudo-shell for controlling the indexed files
9
+ player. It also provides a command API for controlling the indexed files
8
10
  and the state of the player.
9
11
 
10
12
  ### Screenshot
@@ -24,7 +26,10 @@ $ ruby -Ilib bin/muzak-cmd enqueue-artist "The Beatles"
24
26
 
25
27
  API documentation can be found on [RubyDoc](http://www.rubydoc.info/gems/muzak/).
26
28
 
27
- Documentation for user commands can be found under [COMMANDS.md](./COMMANDS.md),
29
+ User documentation for commands can be found under [COMMANDS](COMMANDS.md),
30
+ as well as on RubyDoc.
31
+
32
+ User documentation for configuration can be found under [CONFIGURATION](CONFIGURATION.md),
28
33
  as well as on RubyDoc.
29
34
 
30
35
  ### TODO
@@ -8,6 +8,7 @@ module Muzak
8
8
  # @example
9
9
  # # corresponds to `art-geometry: 300x300` in configuration
10
10
  # Config.art_geometry # => "300x300"
11
+ # @see file:CONFIGURATION.md User Configuration
11
12
  class Config
12
13
  if File.exist?(CONFIG_FILE)
13
14
  @config = YAML::load_file(CONFIG_FILE)
@@ -46,6 +47,8 @@ module Muzak
46
47
  false
47
48
  end
48
49
 
50
+ # Synchronizes the in-memory configuration with {CONFIG_FILE}.
51
+ # @return [void]
49
52
  def self.sync!
50
53
  File.open(CONFIG_FILE, "w") { |io| io.write @config.to_yaml }
51
54
  end
@@ -1,6 +1,6 @@
1
1
  module Muzak
2
2
  # Muzak's current version
3
- VERSION = "0.1.4".freeze
3
+ VERSION = "0.1.5".freeze
4
4
 
5
5
  # The root directory for all user configuration, data, etc
6
6
  CONFIG_DIR = File.expand_path("~/.config/muzak").freeze
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
4
+ version: 0.1.5
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-03 00:00:00.000000000 Z
11
+ date: 2017-01-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: taglib-ruby
@@ -35,6 +35,7 @@ extra_rdoc_files: []
35
35
  files:
36
36
  - ".yardopts"
37
37
  - COMMANDS.md
38
+ - CONFIGURATION.md
38
39
  - LICENSE
39
40
  - README.md
40
41
  - bin/muzak-cmd