summaryrefslogtreecommitdiff
path: root/mpdlib.rb
diff options
context:
space:
mode:
authorDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2009-07-21 14:10:53 -0700
committerDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2009-07-21 14:10:53 -0700
commit89e03522718985ffd85837caf03f263055fbbd14 (patch)
tree1f4fa956e335a1e6bda390eabde2a8e74b35fa93 /mpdlib.rb
downloadruby-libmpd-89e03522718985ffd85837caf03f263055fbbd14.tar.gz
ruby-libmpd-89e03522718985ffd85837caf03f263055fbbd14.tar.xz
Initial import: Class MPD with connect method.
Diffstat (limited to 'mpdlib.rb')
-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