mpd_client and mpd 0.17
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
diff --git a/lib/mpd_client.rb b/lib/mpd_client.rb
index 8650678..403eb50 100644
--- a/lib/mpd_client.rb
+++ b/lib/mpd_client.rb
@@ -10,6 +10,8 @@ NEXT = "list_OK"
# MPD changelog: http://git.musicpd.org/cgit/master/mpd.git/plain/NEWS
# http://mpd.wikia.com/wiki/MusicPlayerDaemonCommands
+# http://git.musicpd.org/cgit/cirrus/mpd.git/plain/doc/protocol.xml
+#
COMMANDS = {
# Status Commands
"clearerror" => "fetch_nothing",
@@ -80,6 +82,8 @@ COMMANDS = {
"listallinfo" => "fetch_database",
"lsinfo" => "fetch_database",
"search" => "fetch_songs",
+ "searchadd" => "fetch_nothing",
+ "searchaddp1" => "fetch_nothing",
"update" => "fetch_item",
"rescan" => "fetch_item",
# Sticker Commands
@@ -120,8 +124,13 @@ class MPDClient
end
def connect(host = 'localhost', port = 6600)
- @socket = TCPSocket.new(host, port)
- hello
+ if host.start_with?('/')
+ @socket = UNIXSocket.new(host)
+ hello
+ else
+ @socket = TCPSocket.new(host, port)
+ hello
+ end
end
def disconnect
@@ -321,7 +330,7 @@ class MPDClient
end
def escape(text)
- text.gsub("\\", "\\\\").gsub('"', '\\"')
+ text.to_s.gsub("\\", "\\\\").gsub('"', '\\"')
end
end
diff --git a/lib/mpd_client/version.rb b/lib/mpd_client/version.rb
index d32120a..c00860a 100644
--- a/lib/mpd_client/version.rb
+++ b/lib/mpd_client/version.rb
@@ -1,5 +1,5 @@
# -*- encoding: utf-8 -*-
class MPDClient
- VERSION = "0.0.1"
+ VERSION = "0.0.2"
end