candelabra 1.1.0 → 1.1.1.beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile.lock +1 -1
- data/candelabra.gemspec +2 -2
- data/lib/candelabra/event_cmd.rb +0 -9
- data/lib/candelabra/installer.rb +6 -3
- data/lib/candelabra/osx.rb +1 -1
- data/lib/candelabra/remote.rb +17 -11
- data/lib/candelabra/version.rb +1 -1
- metadata +10 -8
data/Gemfile.lock
CHANGED
data/candelabra.gemspec
CHANGED
|
@@ -5,8 +5,8 @@ Gem::Specification.new do |s|
|
|
|
5
5
|
s.name = "candelabra"
|
|
6
6
|
s.version = Candelabra::VERSION
|
|
7
7
|
s.platform = Gem::Platform::RUBY
|
|
8
|
-
s.authors = []
|
|
9
|
-
s.email = []
|
|
8
|
+
s.authors = ['cajun']
|
|
9
|
+
s.email = ['zac@kleinpeter.org']
|
|
10
10
|
s.homepage = "http://rubygems.org/gems/candelabra"
|
|
11
11
|
s.summary = "Wrapper for pianobar"
|
|
12
12
|
s.description = "initial wrapper for pianobar"
|
data/lib/candelabra/event_cmd.rb
CHANGED
|
@@ -20,17 +20,8 @@ module Candelabra
|
|
|
20
20
|
Remote.flush
|
|
21
21
|
when 'userlogin'
|
|
22
22
|
unless @pRet.to_i == 1
|
|
23
|
-
`notify-send Bad Username`
|
|
24
23
|
`ps a | grep 'candelabra install' | cut -c1-5`.split("\n").each{|id| `kill #{id}` unless Process.pid == id.to_i }
|
|
25
24
|
end
|
|
26
|
-
|
|
27
|
-
else
|
|
28
|
-
#`notify-send #{@pRet}`
|
|
29
|
-
#`notify-send #{command}`
|
|
30
|
-
#`notify-send #{command}`
|
|
31
|
-
#instance_variables.each do |i|
|
|
32
|
-
# `notify-send #{i}`
|
|
33
|
-
#end
|
|
34
25
|
end
|
|
35
26
|
end
|
|
36
27
|
|
data/lib/candelabra/installer.rb
CHANGED
|
@@ -89,6 +89,9 @@ module Candelabra
|
|
|
89
89
|
end
|
|
90
90
|
|
|
91
91
|
def start_pianobar
|
|
92
|
+
Remote.flush
|
|
93
|
+
Remote.flush_input
|
|
94
|
+
|
|
92
95
|
if Pianobar.running?
|
|
93
96
|
print "Restarting Pianobar with Autostation".ljust(CONSOLE_WIDTH + 20, '.')
|
|
94
97
|
Pianobar.restart
|
|
@@ -113,13 +116,13 @@ module Candelabra
|
|
|
113
116
|
|
|
114
117
|
if Pianobar.running?
|
|
115
118
|
`echo '0' > #{Installer.input_path}` # forcing auto selection of the first station
|
|
116
|
-
sleep(
|
|
119
|
+
sleep( 5 )
|
|
117
120
|
puts ''
|
|
118
121
|
puts "Select Auto station".center( CONSOLE_WIDTH + 20, ' ' )
|
|
119
|
-
stations = Remote.stations
|
|
120
|
-
stations.each { |s| puts s }
|
|
121
122
|
|
|
122
123
|
begin
|
|
124
|
+
stations = Remote.stations
|
|
125
|
+
stations.each { |s| puts s }
|
|
123
126
|
result = ask 'Select Station and press ENTER:'
|
|
124
127
|
raise "You must enter the number of a valid station" unless result == result.to_i.to_s
|
|
125
128
|
raise "That is not a valid station it must be a number between 0 and #{stations.size - 1}" unless (0..stations.size - 1).include? result.to_i
|
data/lib/candelabra/osx.rb
CHANGED
|
@@ -56,7 +56,7 @@ module Candelabra
|
|
|
56
56
|
|
|
57
57
|
# Notify the user using growl
|
|
58
58
|
def notify
|
|
59
|
-
%x[growlnotify --image #{art_work} -t "Pianobar - #{stationName}" -m "Now Playing: #{artist} - #{title}"]
|
|
59
|
+
%x[growlnotify --image #{art_work} -t "Pianobar - #{stationName}" -m "Now Playing: #{artist} - #{title}"] if notify?
|
|
60
60
|
end
|
|
61
61
|
|
|
62
62
|
end
|
data/lib/candelabra/remote.rb
CHANGED
|
@@ -42,7 +42,7 @@ module Candelabra
|
|
|
42
42
|
#
|
|
43
43
|
# Returns command you passed in
|
|
44
44
|
def execute_command cmd
|
|
45
|
-
return
|
|
45
|
+
return nil unless Candelabra::Pianobar.running?
|
|
46
46
|
if commands.include? cmd
|
|
47
47
|
%x[ echo #{commands[cmd]} > #{Candelabra::Installer.ctl_path} ]
|
|
48
48
|
else
|
|
@@ -124,7 +124,7 @@ module Candelabra
|
|
|
124
124
|
# Returns an array of stations
|
|
125
125
|
def stations
|
|
126
126
|
list = []
|
|
127
|
-
execute_command( :
|
|
127
|
+
execute_command( :stations )
|
|
128
128
|
output do |io|
|
|
129
129
|
io.lines.each do |line|
|
|
130
130
|
/(\[\?\])/ =~ line
|
|
@@ -136,15 +136,11 @@ module Candelabra
|
|
|
136
136
|
end
|
|
137
137
|
|
|
138
138
|
def flush
|
|
139
|
-
output
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
break
|
|
145
|
-
end
|
|
146
|
-
end
|
|
147
|
-
end
|
|
139
|
+
output { |io| io.flush }
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
def flush_input
|
|
143
|
+
input { |io| io.flush }
|
|
148
144
|
end
|
|
149
145
|
|
|
150
146
|
# The out put file for the commands
|
|
@@ -153,6 +149,16 @@ module Candelabra
|
|
|
153
149
|
# Yields and IO reader for pianobar's output
|
|
154
150
|
def output
|
|
155
151
|
File.open( Candelabra::Installer.output_path, 'r+' ) do |io|
|
|
152
|
+
yield(io)
|
|
153
|
+
end
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
# The out put file for the commands
|
|
157
|
+
# This contains all the output from pianobar
|
|
158
|
+
#
|
|
159
|
+
# Yields and IO reader for pianobar's output
|
|
160
|
+
def input
|
|
161
|
+
File.open( Candelabra::Installer.input_path, 'r+' ) do |io|
|
|
156
162
|
yield( io )
|
|
157
163
|
end
|
|
158
164
|
end
|
data/lib/candelabra/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: candelabra
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.1.
|
|
5
|
-
prerelease:
|
|
4
|
+
version: 1.1.1.beta
|
|
5
|
+
prerelease: 6
|
|
6
6
|
platform: ruby
|
|
7
|
-
authors:
|
|
7
|
+
authors:
|
|
8
|
+
- cajun
|
|
8
9
|
autorequire: !!null
|
|
9
10
|
bindir: bin
|
|
10
11
|
cert_chain: []
|
|
@@ -13,7 +14,7 @@ default_executable: !!null
|
|
|
13
14
|
dependencies:
|
|
14
15
|
- !ruby/object:Gem::Dependency
|
|
15
16
|
name: bundler
|
|
16
|
-
requirement: &
|
|
17
|
+
requirement: &2157239220 !ruby/object:Gem::Requirement
|
|
17
18
|
none: false
|
|
18
19
|
requirements:
|
|
19
20
|
- - ~>
|
|
@@ -21,10 +22,10 @@ dependencies:
|
|
|
21
22
|
version: 1.0.0
|
|
22
23
|
type: :development
|
|
23
24
|
prerelease: false
|
|
24
|
-
version_requirements: *
|
|
25
|
+
version_requirements: *2157239220
|
|
25
26
|
- !ruby/object:Gem::Dependency
|
|
26
27
|
name: minitest
|
|
27
|
-
requirement: &
|
|
28
|
+
requirement: &2157238760 !ruby/object:Gem::Requirement
|
|
28
29
|
none: false
|
|
29
30
|
requirements:
|
|
30
31
|
- - ! '>='
|
|
@@ -32,9 +33,10 @@ dependencies:
|
|
|
32
33
|
version: 2.0.2
|
|
33
34
|
type: :development
|
|
34
35
|
prerelease: false
|
|
35
|
-
version_requirements: *
|
|
36
|
+
version_requirements: *2157238760
|
|
36
37
|
description: initial wrapper for pianobar
|
|
37
|
-
email:
|
|
38
|
+
email:
|
|
39
|
+
- zac@kleinpeter.org
|
|
38
40
|
executables:
|
|
39
41
|
- candelabra
|
|
40
42
|
extensions: []
|