diff options
author | David Vazgenovich Shakaryan <dvshakaryan@gmail.com> | 2009-07-21 14:10:53 -0700 |
---|---|---|
committer | David Vazgenovich Shakaryan <dvshakaryan@gmail.com> | 2009-07-21 14:10:53 -0700 |
commit | 89e03522718985ffd85837caf03f263055fbbd14 (patch) | |
tree | 1f4fa956e335a1e6bda390eabde2a8e74b35fa93 | |
download | ruby-libmpd-89e03522718985ffd85837caf03f263055fbbd14.tar.gz ruby-libmpd-89e03522718985ffd85837caf03f263055fbbd14.tar.xz |
Initial import: Class MPD with connect method.
-rw-r--r-- | mpdlib.rb | 20 |
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 |