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 +4 -4
- data/COMMANDS.md +28 -0
- data/lib/muzak.rb +1 -1
- data/lib/muzak/cmd/index.rb +9 -0
- data/lib/muzak/song.rb +23 -0
- 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: 554e40f18c30b64f0e2c9be0ee3ee6227b7449a3
|
4
|
+
data.tar.gz: feaadbe0d3ceb603cb7d8013d9ca2faad3e703a0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3fcce8ffa18023a30c59f79e8ea5795972378af99b4d69df3969de23922773c37634bffd0bebe05d3da6eedfef7cb734fdb224fe927a8c9642139e590663d8d2
|
7
|
+
data.tar.gz: 2d940d322ec8116e4873da8d24d9318c61a2397fec5639ff8e2526a52d0a4dd0f1e1dcfefc5c4dd2467b0b7abdf4620e3df969678595cec232b417764176ea46
|
data/COMMANDS.md
CHANGED
@@ -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.
|
data/lib/muzak.rb
CHANGED
data/lib/muzak/cmd/index.rb
CHANGED
@@ -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`
|
data/lib/muzak/song.rb
CHANGED
@@ -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.
|
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-
|
11
|
+
date: 2017-03-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: taglib-ruby
|