muzak 0.3.9 → 0.4.0

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: c8e7f564cf871bb52f85bee9f9ce174955f5cb8b
4
- data.tar.gz: 34f79d424c5d0ff80141d5b7469bbec26a8f2490
3
+ metadata.gz: 554e40f18c30b64f0e2c9be0ee3ee6227b7449a3
4
+ data.tar.gz: feaadbe0d3ceb603cb7d8013d9ca2faad3e703a0
5
5
  SHA512:
6
- metadata.gz: 117f0feb185eed6a940db827d565580a4e274bfe30bc448c7ad54c0aaca8e088b349947be63c6aa3b140ec3366dda053aa525d467ea3245a1557ac5968c2bad5
7
- data.tar.gz: 65c7640651c2bba52a89499db61da01819911d625ecddf480831cd01db6bdfdc6104467b73c33669c562ddafa466a282511cc01de173dca69670f9f68d1696b4
6
+ metadata.gz: 3fcce8ffa18023a30c59f79e8ea5795972378af99b4d69df3969de23922773c37634bffd0bebe05d3da6eedfef7cb734fdb224fe927a8c9642139e590663d8d2
7
+ data.tar.gz: 2d940d322ec8116e4873da8d24d9318c61a2397fec5639ff8e2526a52d0a4dd0f1e1dcfefc5c4dd2467b0b7abdf4620e3df969678595cec232b417764176ea46
@@ -179,6 +179,34 @@ $ muzak-cmd config-get jukebox-size
179
179
  }
180
180
  ```
181
181
 
182
+ ## `dump-index`
183
+
184
+ Dumps the current state of muzak's index into a response.
185
+
186
+ ### Syntax
187
+
188
+ `dump-index`
189
+
190
+ ### Example
191
+
192
+ ```bash
193
+ $ muzak-cmd dump-index
194
+ ```
195
+
196
+ ### Example Response
197
+
198
+ ```json
199
+ {
200
+ "response" : {
201
+ "error" : null,
202
+ "method" : "dump_index",
203
+ "data" : {
204
+ "index": { /* ... */ }
205
+ }
206
+ }
207
+ }
208
+ ```
209
+
182
210
  ## `enqueue-album`
183
211
 
184
212
  Adds the given album to the player's queue.
@@ -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.9".freeze
15
+ VERSION = "0.4.0".freeze
16
16
  end
@@ -14,6 +14,15 @@ module Muzak
14
14
  }
15
15
  end
16
16
 
17
+ # Dump a hash representation of the index.
18
+ # @command `dump-index`
19
+ # @cmdexample `muzak> dump-index`
20
+ def dump_index
21
+ build_response data: {
22
+ index: index.hash
23
+ }
24
+ end
25
+
17
26
  # List all artists in the index.
18
27
  # @command `list-artists`
19
28
  # @cmdexample `muzak> list-artists`
@@ -1,4 +1,5 @@
1
1
  require "taglib"
2
+ require "json"
2
3
 
3
4
  module Muzak
4
5
  # Represents a single song for muzak.
@@ -81,5 +82,27 @@ module Muzak
81
82
  def ==(other)
82
83
  other.is_a?(Song) && path == other.path
83
84
  end
85
+
86
+ # @return [Hash] a hash representation of the song, including pathname
87
+ def to_h
88
+ {
89
+ path: path,
90
+ title: title,
91
+ artist: artist,
92
+ album: album,
93
+ year: year,
94
+ track: track,
95
+ genre: genre,
96
+ comment: comment,
97
+ length: length,
98
+ }
99
+ end
100
+
101
+ # @param options [Array] options passed to the internal `to_json` call
102
+ # @return [String] a JSON-serialized representation of the song
103
+ # @note uses {to_h} to build the representation
104
+ def to_json(*options)
105
+ to_h.to_json(*options)
106
+ end
84
107
  end
85
108
  end
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.3.9
4
+ version: 0.4.0
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-02-27 00:00:00.000000000 Z
11
+ date: 2017-03-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: taglib-ruby