candelabra 1.1.1.beta1 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/candelabra.gemspec +2 -2
- data/lib/candelabra/event_cmd.rb +9 -0
- data/lib/candelabra/installer.rb +3 -6
- data/lib/candelabra/osx.rb +1 -1
- data/lib/candelabra/remote.rb +10 -19
- data/lib/candelabra/version.rb +1 -1
- metadata +8 -10
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 = []
|
9
|
+
s.email = []
|
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,8 +20,17 @@ module Candelabra
|
|
20
20
|
Remote.flush
|
21
21
|
when 'userlogin'
|
22
22
|
unless @pRet.to_i == 1
|
23
|
+
`notify-send Bad Username`
|
23
24
|
`ps a | grep 'candelabra install' | cut -c1-5`.split("\n").each{|id| `kill #{id}` unless Process.pid == id.to_i }
|
24
25
|
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
|
25
34
|
end
|
26
35
|
end
|
27
36
|
|
data/lib/candelabra/installer.rb
CHANGED
@@ -89,9 +89,6 @@ module Candelabra
|
|
89
89
|
end
|
90
90
|
|
91
91
|
def start_pianobar
|
92
|
-
Remote.flush
|
93
|
-
Remote.flush_input
|
94
|
-
|
95
92
|
if Pianobar.running?
|
96
93
|
print "Restarting Pianobar with Autostation".ljust(CONSOLE_WIDTH + 20, '.')
|
97
94
|
Pianobar.restart
|
@@ -116,13 +113,13 @@ module Candelabra
|
|
116
113
|
|
117
114
|
if Pianobar.running?
|
118
115
|
`echo '0' > #{Installer.input_path}` # forcing auto selection of the first station
|
119
|
-
sleep(
|
116
|
+
sleep( 2 )
|
120
117
|
puts ''
|
121
118
|
puts "Select Auto station".center( CONSOLE_WIDTH + 20, ' ' )
|
119
|
+
stations = Remote.stations
|
120
|
+
stations.each { |s| puts s }
|
122
121
|
|
123
122
|
begin
|
124
|
-
stations = Remote.stations
|
125
|
-
stations.each { |s| puts s }
|
126
123
|
result = ask 'Select Station and press ENTER:'
|
127
124
|
raise "You must enter the number of a valid station" unless result == result.to_i.to_s
|
128
125
|
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}"]
|
60
60
|
end
|
61
61
|
|
62
62
|
end
|
data/lib/candelabra/remote.rb
CHANGED
@@ -42,7 +42,6 @@ module Candelabra
|
|
42
42
|
#
|
43
43
|
# Returns command you passed in
|
44
44
|
def execute_command cmd
|
45
|
-
return nil unless Candelabra::Pianobar.running?
|
46
45
|
if commands.include? cmd
|
47
46
|
%x[ echo #{commands[cmd]} > #{Candelabra::Installer.ctl_path} ]
|
48
47
|
else
|
@@ -124,7 +123,7 @@ module Candelabra
|
|
124
123
|
# Returns an array of stations
|
125
124
|
def stations
|
126
125
|
list = []
|
127
|
-
execute_command( :
|
126
|
+
execute_command( :change_station )
|
128
127
|
output do |io|
|
129
128
|
io.lines.each do |line|
|
130
129
|
/(\[\?\])/ =~ line
|
@@ -136,13 +135,15 @@ module Candelabra
|
|
136
135
|
end
|
137
136
|
|
138
137
|
def flush
|
139
|
-
output
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
138
|
+
output do |io|
|
139
|
+
loop do
|
140
|
+
begin
|
141
|
+
io.read_nonblock(1);
|
142
|
+
rescue
|
143
|
+
break
|
144
|
+
end
|
145
|
+
end
|
146
|
+
end
|
146
147
|
end
|
147
148
|
|
148
149
|
# The out put file for the commands
|
@@ -151,16 +152,6 @@ module Candelabra
|
|
151
152
|
# Yields and IO reader for pianobar's output
|
152
153
|
def output
|
153
154
|
File.open( Candelabra::Installer.output_path, 'r+' ) do |io|
|
154
|
-
yield(io)
|
155
|
-
end
|
156
|
-
end
|
157
|
-
|
158
|
-
# The out put file for the commands
|
159
|
-
# This contains all the output from pianobar
|
160
|
-
#
|
161
|
-
# Yields and IO reader for pianobar's output
|
162
|
-
def input
|
163
|
-
File.open( Candelabra::Installer.input_path, 'r+' ) do |io|
|
164
155
|
yield( io )
|
165
156
|
end
|
166
157
|
end
|
data/lib/candelabra/version.rb
CHANGED
metadata
CHANGED
@@ -1,11 +1,10 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: candelabra
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.1
|
5
|
-
prerelease:
|
4
|
+
version: 1.1.1
|
5
|
+
prerelease: !!null
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
8
|
-
- cajun
|
7
|
+
authors: []
|
9
8
|
autorequire: !!null
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
@@ -14,7 +13,7 @@ default_executable: !!null
|
|
14
13
|
dependencies:
|
15
14
|
- !ruby/object:Gem::Dependency
|
16
15
|
name: bundler
|
17
|
-
requirement: &
|
16
|
+
requirement: &2153408540 !ruby/object:Gem::Requirement
|
18
17
|
none: false
|
19
18
|
requirements:
|
20
19
|
- - ~>
|
@@ -22,10 +21,10 @@ dependencies:
|
|
22
21
|
version: 1.0.0
|
23
22
|
type: :development
|
24
23
|
prerelease: false
|
25
|
-
version_requirements: *
|
24
|
+
version_requirements: *2153408540
|
26
25
|
- !ruby/object:Gem::Dependency
|
27
26
|
name: minitest
|
28
|
-
requirement: &
|
27
|
+
requirement: &2153408080 !ruby/object:Gem::Requirement
|
29
28
|
none: false
|
30
29
|
requirements:
|
31
30
|
- - ! '>='
|
@@ -33,10 +32,9 @@ dependencies:
|
|
33
32
|
version: 2.0.2
|
34
33
|
type: :development
|
35
34
|
prerelease: false
|
36
|
-
version_requirements: *
|
35
|
+
version_requirements: *2153408080
|
37
36
|
description: initial wrapper for pianobar
|
38
|
-
email:
|
39
|
-
- zac@kleinpeter.org
|
37
|
+
email: []
|
40
38
|
executables:
|
41
39
|
- candelabra
|
42
40
|
extensions: []
|