ruby-ampache 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/bin/ruby-ampache +2 -1
- data/lib/lib-classes.rb +13 -1
- metadata +4 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.8
|
data/bin/ruby-ampache
CHANGED
@@ -15,10 +15,10 @@ secure_require 'highline'
|
|
15
15
|
secure_require 'highline/import'
|
16
16
|
secure_require 'parseconfig'
|
17
17
|
secure_require 'nokogiri'
|
18
|
+
secure_require 'iconv'
|
18
19
|
require File.join(File.dirname(__FILE__),'..','lib','lib-ampache')
|
19
20
|
require File.join(File.dirname(__FILE__),'..','lib','lib-classes')
|
20
21
|
|
21
|
-
|
22
22
|
# XXX monkey patch for utf8 on ruby 1.9
|
23
23
|
if /^1\.9/ === RUBY_VERSION then
|
24
24
|
class HighLine
|
@@ -114,6 +114,7 @@ while true
|
|
114
114
|
menu.choice("add another album to playlist") { print_artists(@ar.artists); say(HighLine.new.color(@pl.nowPlaying, :red)) }
|
115
115
|
menu.choice("look for an artist") { print_artists(@ar.artists(ask("Artist name?"))); say(HighLine.new.color(@pl.nowPlaying, :red)) }
|
116
116
|
menu.choice("stop playing") { @pl.stop }
|
117
|
+
menu.choice("pause playing") { @pl.pause; say(HighLine.new.color("paused!",:red)) }
|
117
118
|
menu.choice("about ruby-ampache") { say(HighLine.new.color credits, :red) }
|
118
119
|
menu.choice("quit") { @pl.stop; exit}
|
119
120
|
end
|
data/lib/lib-classes.rb
CHANGED
@@ -99,6 +99,14 @@ class AmpachePlaylist
|
|
99
99
|
@pid = nil
|
100
100
|
end
|
101
101
|
|
102
|
+
def pause
|
103
|
+
begin
|
104
|
+
@stdin.puts "pause" if @pid
|
105
|
+
rescue Errno::EPIPE
|
106
|
+
puts "playlist is over"
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
102
110
|
def next
|
103
111
|
begin
|
104
112
|
@stdin.puts "pt_step 1 1" if @pid
|
@@ -148,7 +156,8 @@ class AmpachePlaylist
|
|
148
156
|
when "file_name" then "ANS_FILENAME"
|
149
157
|
else "ANS_#{field.upcase}"
|
150
158
|
end
|
151
|
-
command("get_#{value}",/#{match}/)
|
159
|
+
res = command("get_#{value}",/#{match}/)
|
160
|
+
res.gsub("#{match}=","").gsub("'","")
|
152
161
|
end
|
153
162
|
|
154
163
|
def command(cmd,match = //)
|
@@ -156,6 +165,9 @@ class AmpachePlaylist
|
|
156
165
|
response = ""
|
157
166
|
until response =~ match
|
158
167
|
response = @stdout.gets
|
168
|
+
#XXX escaping bad utf8 chars
|
169
|
+
ic = Iconv.new('UTF-8//IGNORE', 'UTF-8')
|
170
|
+
response =ic.iconv(response + ' ')[0..-2]
|
159
171
|
end
|
160
172
|
response.gsub("\e[A\r\e[K","")
|
161
173
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-ampache
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 15
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 8
|
10
|
+
version: 0.0.8
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- ghedmat
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-09-
|
18
|
+
date: 2010-09-30 00:00:00 +02:00
|
19
19
|
default_executable: ruby-ampache
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|