muzak 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/muzak +1 -1
- data/lib/muzak/cmd.rb +3 -0
- data/lib/muzak/cmd/playlist.rb +43 -22
- data/lib/muzak/const.rb +3 -2
- data/lib/muzak/instance.rb +2 -2
- data/lib/muzak/playlist.rb +2 -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: b6b8176c9db706a3a44a3bcdd0531cbf4f4bfc06
|
4
|
+
data.tar.gz: cc31f821a39863d88a98e3605102e4720e091609
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b2713fafa4ebd9f793c32a33040d021dd78aa475c283b101a141032de2865ca36423832b19432562bddc64f7699e55b489be40e8d7af4a4faad713d4eb163685
|
7
|
+
data.tar.gz: 177e33819737a1e629640b721f0540cc9ff7d7f44ebce31bda4acf42d30abaf697b862d2a8afc079c392b1d4b08f79529b631a405f8d5d90a7409c08cf9c3133
|
data/bin/muzak
CHANGED
@@ -18,7 +18,7 @@ COMMANDS = Muzak::Cmd.commands
|
|
18
18
|
CONFIG_REGEX = /^config-(get)|(set)|(del)/
|
19
19
|
ARTIST_REGEX = Regexp.union COMMANDS.select{ |c| c =~ /artist/ }.map { |c| /^#{c}/ }
|
20
20
|
ALBUM_REGEX = Regexp.union COMMANDS.select{ |c| c =~ /album/ }.map { |c| /^#{c}/ }
|
21
|
-
PLAYLIST_REGEX = /^playlist-
|
21
|
+
PLAYLIST_REGEX = /^playlist-delete/
|
22
22
|
|
23
23
|
comp = proc do |s|
|
24
24
|
case Readline.line_buffer
|
data/lib/muzak/cmd.rb
CHANGED
data/lib/muzak/cmd/playlist.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module Muzak
|
2
2
|
module Cmd
|
3
|
-
def
|
4
|
-
!!@
|
3
|
+
def _playlists_loaded?
|
4
|
+
!!@playlists
|
5
5
|
end
|
6
6
|
|
7
7
|
def list_playlists(*args)
|
@@ -10,14 +10,18 @@ module Muzak
|
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
13
|
-
def
|
14
|
-
fail_arity(args, 1)
|
15
|
-
pname = args.shift
|
13
|
+
def playlists_load(*args)
|
14
|
+
# fail_arity(args, 1)
|
15
|
+
# pname = args.shift
|
16
|
+
@playlists = {}
|
17
|
+
@playlists.default_proc = proc { |h, k| h[k] = Playlist.new(k) }
|
16
18
|
|
17
|
-
|
18
|
-
|
19
|
+
Playlist.playlist_names.each do |pname|
|
20
|
+
debug "loading playlist '#{pname}'"
|
21
|
+
@playlists[pname] = Playlist.new(pname)
|
22
|
+
end
|
19
23
|
|
20
|
-
event :
|
24
|
+
event :playlists_loaded, @playlist
|
21
25
|
end
|
22
26
|
|
23
27
|
def playlist_delete(*args)
|
@@ -27,18 +31,23 @@ module Muzak
|
|
27
31
|
debug "deleting playist '#{pname}'"
|
28
32
|
|
29
33
|
Playlist.delete!(pname)
|
30
|
-
@playlist = nil
|
34
|
+
@playlist[pname] = nil
|
31
35
|
end
|
32
36
|
|
33
37
|
def enqueue_playlist(*args)
|
34
|
-
return unless
|
38
|
+
return unless _playlists_loaded?
|
39
|
+
fail_arity(args, 1)
|
40
|
+
pname = args.shift
|
35
41
|
|
36
|
-
@player.enqueue_playlist(@
|
37
|
-
event :playlist_enqueued, @
|
42
|
+
@player.enqueue_playlist(@playlists[pname])
|
43
|
+
event :playlist_enqueued, @playlists[pname]
|
38
44
|
end
|
39
45
|
|
40
46
|
def playlist_add_album(*args)
|
41
|
-
return unless
|
47
|
+
return unless _playlists_loaded?
|
48
|
+
|
49
|
+
pname = args.shift
|
50
|
+
return if pname.nil?
|
42
51
|
|
43
52
|
album_name = args.join(" ")
|
44
53
|
return if album_name.nil?
|
@@ -46,34 +55,46 @@ module Muzak
|
|
46
55
|
album = @index.albums[album_name]
|
47
56
|
return if album.nil?
|
48
57
|
|
49
|
-
@
|
58
|
+
@playlists[pname].add(album.songs)
|
50
59
|
end
|
51
60
|
|
52
61
|
def playlist_add_artist(*args)
|
53
|
-
return unless
|
62
|
+
return unless _playlists_loaded?
|
63
|
+
|
64
|
+
pname = args.shift
|
65
|
+
return if pname.nil?
|
54
66
|
|
55
67
|
artist = args.join(" ")
|
56
68
|
return if artist.nil?
|
57
69
|
|
58
|
-
@
|
70
|
+
@playlists[pname].add(@index.songs_by(artist))
|
59
71
|
end
|
60
72
|
|
61
73
|
def playlist_add_current(*args)
|
62
|
-
return unless @player.running? &&
|
74
|
+
return unless @player.running? && _playlists_loaded?
|
75
|
+
|
76
|
+
pname = args.shift
|
77
|
+
return if pname.nil?
|
63
78
|
|
64
|
-
@
|
79
|
+
@playlists[pname].add @player.now_playing
|
65
80
|
end
|
66
81
|
|
67
82
|
def playlist_del_current(*args)
|
68
|
-
return unless @player.running? &&
|
83
|
+
return unless @player.running? && _playlists_loaded?
|
69
84
|
|
70
|
-
|
85
|
+
pname = args.shift
|
86
|
+
return if pname.nil?
|
87
|
+
|
88
|
+
@playlists[pname].delete @player.now_playing
|
71
89
|
end
|
72
90
|
|
73
91
|
def playlist_shuffle(*args)
|
74
|
-
return unless
|
92
|
+
return unless _playlists_loaded?
|
93
|
+
|
94
|
+
pname = args.shift
|
95
|
+
return if pname.nil?
|
75
96
|
|
76
|
-
@
|
97
|
+
@playlists[pname].shuffle!
|
77
98
|
end
|
78
99
|
end
|
79
100
|
end
|
data/lib/muzak/const.rb
CHANGED
@@ -1,17 +1,18 @@
|
|
1
1
|
module Muzak
|
2
|
-
VERSION = "0.0.
|
2
|
+
VERSION = "0.0.8".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
6
|
INDEX_FILE = File.join(CONFIG_DIR, "index.yml").freeze
|
7
7
|
PLAYLIST_DIR = File.join(CONFIG_DIR, "playlists").freeze
|
8
8
|
USER_PLUGIN_DIR = File.join(CONFIG_DIR, "plugins").freeze
|
9
|
+
USER_COMMAND_DIR = File.join(CONFIG_DIR, "commands").freeze
|
9
10
|
|
10
11
|
PLUGIN_EVENTS = [
|
11
12
|
:player_activated,
|
12
13
|
:player_deactivated,
|
13
14
|
:song_loaded,
|
14
|
-
:
|
15
|
+
:playlists_loaded,
|
15
16
|
:playlist_enqueued
|
16
17
|
]
|
17
18
|
end
|
data/lib/muzak/instance.rb
CHANGED
@@ -30,8 +30,8 @@ module Muzak
|
|
30
30
|
|
31
31
|
@plugins = initialize_plugins!
|
32
32
|
|
33
|
-
|
34
|
-
enqueue_playlist if
|
33
|
+
playlists_load
|
34
|
+
enqueue_playlist @config["autoplay"] if @config["autoplay"]
|
35
35
|
end
|
36
36
|
|
37
37
|
def initialize_plugins!
|
data/lib/muzak/playlist.rb
CHANGED
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.8
|
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-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: taglib-ruby
|