muzak 0.0.10 → 0.0.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -2
- data/bin/muzak +2 -7
- data/bin/muzakd +3 -8
- data/lib/muzak/config.rb +2 -0
- data/lib/muzak/const.rb +2 -2
- data/lib/muzak/index.rb +19 -12
- data/lib/muzak/instance.rb +1 -4
- data/lib/muzak/utils.rb +3 -3
- 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: bfec18a0835cc1c148e9bf4c1ee3c9770143ba46
|
4
|
+
data.tar.gz: 44f5b96244563e8161d6c9950079551b4554d80a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4c8c79d444285e835e753fe1582147a30de11bf96a9d3d18f2af54b116ff315937000a88ab1a2a8b1c89de767ac0692d95125bbbc01557cd42ed808c96173d68
|
7
|
+
data.tar.gz: bbe8db2c4bdbe6f0df3eea079de83795ef4638437268ef779d5231ea8c3afde337e437335ff30a6899ab92d1defb8760f384f02b72c59524b842beefcd67b151
|
data/README.md
CHANGED
@@ -18,7 +18,7 @@ Muzak is still a work in process. Don't expect stability or pleasant output.
|
|
18
18
|
On the command-line:
|
19
19
|
|
20
20
|
```shell
|
21
|
-
$ ruby -Ilib bin/muzak.rb
|
21
|
+
$ ruby -Ilib bin/muzak.rb
|
22
22
|
muzak> help
|
23
23
|
```
|
24
24
|
|
@@ -37,4 +37,3 @@ $ ruby -Ilib bin/muzak-cmd "command"
|
|
37
37
|
* current indexing/sorting logic is terrible
|
38
38
|
* all the documentation
|
39
39
|
* readline's tab complete is terrible with spaces (maybe use `bond`?)
|
40
|
-
* replace YAML index with a more space/time efficient format (JSON, msgpack, Marshal?)
|
data/bin/muzak
CHANGED
@@ -4,14 +4,9 @@ require "muzak"
|
|
4
4
|
require "readline"
|
5
5
|
require "shellwords"
|
6
6
|
|
7
|
-
|
8
|
-
debug: ARGV.include?("--debug") || ARGV.include?("-d"),
|
9
|
-
verbose: ARGV.include?("--verbose") || ARGV.include?("-v"),
|
10
|
-
}
|
7
|
+
Thread.abort_on_exception = Muzak::Config.debug
|
11
8
|
|
12
|
-
|
13
|
-
|
14
|
-
muzak = Muzak::Instance.new(opts)
|
9
|
+
muzak = Muzak::Instance.new
|
15
10
|
|
16
11
|
COMMANDS = Muzak::Cmd.commands
|
17
12
|
|
data/bin/muzakd
CHANGED
@@ -3,15 +3,10 @@
|
|
3
3
|
require "muzak"
|
4
4
|
require "shellwords"
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
verbose: ARGV.include?("--verbose") || ARGV.include?("-v"),
|
9
|
-
}
|
6
|
+
Process.daemon unless Muzak::Config.debug || Muzak::Config.verbose
|
7
|
+
Thread.abort_on_exception = Muzak::Config.debug
|
10
8
|
|
11
|
-
|
12
|
-
Thread.abort_on_exception = opts[:debug]
|
13
|
-
|
14
|
-
muzak = Muzak::Instance.new(opts)
|
9
|
+
muzak = Muzak::Instance.new
|
15
10
|
|
16
11
|
fifo_path = File.join(Muzak::CONFIG_DIR, "muzak.fifo")
|
17
12
|
File.delete(fifo_path) if File.exist?(fifo_path) # just in case a previous session died
|
data/lib/muzak/config.rb
CHANGED
data/lib/muzak/const.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
module Muzak
|
2
|
-
VERSION = "0.0.
|
2
|
+
VERSION = "0.0.11".freeze
|
3
3
|
|
4
4
|
CONFIG_DIR = File.expand_path("~/.config/muzak").freeze
|
5
5
|
CONFIG_FILE = File.join(CONFIG_DIR, "muzak.yml").freeze
|
6
|
-
INDEX_FILE = File.join(CONFIG_DIR, "index.
|
6
|
+
INDEX_FILE = File.join(CONFIG_DIR, "index.dat").freeze
|
7
7
|
PLAYLIST_DIR = File.join(CONFIG_DIR, "playlists").freeze
|
8
8
|
USER_PLUGIN_DIR = File.join(CONFIG_DIR, "plugins").freeze
|
9
9
|
USER_COMMAND_DIR = File.join(CONFIG_DIR, "commands").freeze
|
data/lib/muzak/index.rb
CHANGED
@@ -9,7 +9,7 @@ module Muzak
|
|
9
9
|
|
10
10
|
if File.exist?(INDEX_FILE)
|
11
11
|
verbose "loading index from #{INDEX_FILE}"
|
12
|
-
@hash =
|
12
|
+
@hash = Marshal::load(File.read INDEX_FILE)
|
13
13
|
return unless outdated?
|
14
14
|
end
|
15
15
|
|
@@ -19,7 +19,9 @@ module Muzak
|
|
19
19
|
def build!
|
20
20
|
@hash = build_index_hash!
|
21
21
|
|
22
|
-
|
22
|
+
debug "indexed #{albums.length} albums by #{artists.length} artists"
|
23
|
+
|
24
|
+
File.open(INDEX_FILE, "w") { |io| io.write Marshal::dump @hash }
|
23
25
|
end
|
24
26
|
|
25
27
|
def deep?
|
@@ -35,19 +37,21 @@ module Muzak
|
|
35
37
|
end
|
36
38
|
|
37
39
|
def artists
|
38
|
-
@hash["artists"].keys
|
40
|
+
@artists ||= @hash["artists"].keys
|
39
41
|
end
|
40
42
|
|
41
43
|
def albums
|
42
|
-
albums_hash
|
44
|
+
@albums_hash ||= begin
|
45
|
+
albums_hash = {}
|
43
46
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
+
artists.each do |a|
|
48
|
+
@hash["artists"][a]["albums"].each do |title, album_hash|
|
49
|
+
albums_hash[title] = Album.new(title, album_hash)
|
50
|
+
end
|
47
51
|
end
|
48
|
-
end
|
49
52
|
|
50
|
-
|
53
|
+
albums_hash
|
54
|
+
end
|
51
55
|
end
|
52
56
|
|
53
57
|
def album_names
|
@@ -55,9 +59,12 @@ module Muzak
|
|
55
59
|
end
|
56
60
|
|
57
61
|
def albums_by(artist)
|
58
|
-
|
59
|
-
|
60
|
-
|
62
|
+
if artists.include?(artist)
|
63
|
+
@hash["artists"][artist]["albums"].map { |title, album| Album.new(title, album) }
|
64
|
+
else
|
65
|
+
error "no such artist: '#{artist}'" unless @hash["artists"].key?(artist)
|
66
|
+
[]
|
67
|
+
end
|
61
68
|
end
|
62
69
|
|
63
70
|
def jukebox(count = 50)
|
data/lib/muzak/instance.rb
CHANGED
@@ -15,9 +15,6 @@ module Muzak
|
|
15
15
|
attr_reader :index, :player, :plugins, :playlists
|
16
16
|
|
17
17
|
def initialize(opts = {})
|
18
|
-
$debug = opts[:debug]
|
19
|
-
$verbose = opts[:verbose]
|
20
|
-
|
21
18
|
verbose "muzak is starting..."
|
22
19
|
|
23
20
|
@index = Index.new(Config.music, deep: Config.deep_index)
|
@@ -37,7 +34,7 @@ module Muzak
|
|
37
34
|
plugins.each do |plugin|
|
38
35
|
Thread.new do
|
39
36
|
plugin.send(type, *args)
|
40
|
-
end
|
37
|
+
end
|
41
38
|
end
|
42
39
|
end
|
43
40
|
end
|
data/lib/muzak/utils.rb
CHANGED
@@ -9,7 +9,7 @@ module Muzak
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def music?(filename)
|
12
|
-
[".mp3", ".flac", ".m4a", ".wav", ".ogg", ".oga", ".opus"].include?(File.extname(filename))
|
12
|
+
[".mp3", ".flac", ".m4a", ".wav", ".ogg", ".oga", ".opus"].include?(File.extname(filename.downcase))
|
13
13
|
end
|
14
14
|
|
15
15
|
def album_art?(filename)
|
@@ -17,11 +17,11 @@ module Muzak
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def debug?
|
20
|
-
|
20
|
+
Config.debug
|
21
21
|
end
|
22
22
|
|
23
23
|
def verbose?
|
24
|
-
|
24
|
+
Config.verbose
|
25
25
|
end
|
26
26
|
|
27
27
|
def pretty(color = :none, str)
|
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.0.
|
4
|
+
version: 0.0.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- William Woodruff
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-12-
|
11
|
+
date: 2016-12-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: taglib-ruby
|