summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mpdlib.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/mpdlib.rb b/mpdlib.rb
new file mode 100644
index 0000000..33c0585
--- /dev/null
+++ b/mpdlib.rb
@@ -0,0 +1,20 @@
+#!/usr/bin/env ruby
+#
+# Copyright 2009 David Vazgenovich Shakaryan <dvshakaryan@gmail.com>
+# Distributed under the terms of the GNU General Public License v3.
+# See http://www.gnu.org/licenses/gpl.txt for the full license text.
+
+require 'socket'
+
+class MPD
+ def initialize host='localhost', port=6600
+ @host = host
+ @port = port
+ end
+
+ def connect
+ # Connect to MPD and return response.
+ @socket = TCPSocket.new @host, @port
+ return @socket.gets.chomp
+ end
+end