conquer-mpd 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +21 -0
- data/README.md +1 -1
- data/conquer-mpd.gemspec +1 -0
- data/lib/conquer/mpd.rb +23 -7
- data/lib/conquer/mpd/version.rb +1 -1
- metadata +17 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5749fe68310bf6bed5f56bdeec3ee6fd2bed1ce6
|
4
|
+
data.tar.gz: c7beb8e20ce80b0fbcd3e719a8043be4e226c300
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 45f4a0367cea5a338df6c464cd476ef27415f66083e8088c69c222dfb585e78f650d9973e799265afffe265e2b487b1d9c17bdbe6ac5b681012ba347b73d8834
|
7
|
+
data.tar.gz: 5f6b165299560f21fe0ccde94849285c9963aba8886741d39b8df749549be7419190adf1fc39ccdc81bc936f8bc63de38a7b4a0ed3816d32a276d1989ab270ac
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 Joakim Reinert
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
CHANGED
@@ -32,5 +32,5 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
32
32
|
|
33
33
|
## Contributing
|
34
34
|
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/jreinert/conquer-mpd.
|
36
36
|
|
data/conquer-mpd.gemspec
CHANGED
data/lib/conquer/mpd.rb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
require 'ruby-mpd'
|
2
|
+
require 'celluloid/current'
|
3
|
+
require 'celluloid/notifications'
|
2
4
|
require 'conquer/mpd/version'
|
3
5
|
|
4
6
|
module Conquer
|
@@ -6,6 +8,27 @@ module Conquer
|
|
6
8
|
INSTANCES = Hash.new do |hash, key|
|
7
9
|
hash[key] = MPD.new(*key).tap(&:connect)
|
8
10
|
end
|
11
|
+
|
12
|
+
class Listener
|
13
|
+
include Celluloid
|
14
|
+
include Celluloid::Notifications
|
15
|
+
|
16
|
+
def initialize(*args)
|
17
|
+
options = args.last.is_a?(Hash) ? args.pop : {}
|
18
|
+
@host = args.any? ? args.join(':') : nil
|
19
|
+
@mpd = INSTANCES[args]
|
20
|
+
@events = options[:events]
|
21
|
+
async.run
|
22
|
+
end
|
23
|
+
|
24
|
+
def start
|
25
|
+
publish(:mpd, @mpd)
|
26
|
+
loop do
|
27
|
+
`mpc #{"-h #{@host}" if @host} idle #{@events.join(' ')}`
|
28
|
+
publish(:mpd, @mpd)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
9
32
|
end
|
10
33
|
|
11
34
|
module Helpers
|
@@ -14,12 +37,5 @@ module Conquer
|
|
14
37
|
def mpd(*args)
|
15
38
|
Mpd::INSTANCES[args]
|
16
39
|
end
|
17
|
-
|
18
|
-
def mpd_idle(*args)
|
19
|
-
options = args.last.is_a?(Hash) ? args.pop : {}
|
20
|
-
host = args.any? ? args.join(':') : nil
|
21
|
-
`mpc #{"-h #{host}" if host} idle #{options[:events].join(' ')}`
|
22
|
-
yield mpd(*args)
|
23
|
-
end
|
24
40
|
end
|
25
41
|
end
|
data/lib/conquer/mpd/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: conquer-mpd
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joakim Reinert
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-11-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -80,6 +80,20 @@ dependencies:
|
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0.3'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: celluloid
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0.17'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0.17'
|
83
97
|
description: Adds MPD helpers to conquer
|
84
98
|
email:
|
85
99
|
- mail@jreinert.com
|
@@ -91,6 +105,7 @@ files:
|
|
91
105
|
- ".rspec"
|
92
106
|
- ".travis.yml"
|
93
107
|
- Gemfile
|
108
|
+
- LICENSE
|
94
109
|
- README.md
|
95
110
|
- Rakefile
|
96
111
|
- bin/console
|