From 89e03522718985ffd85837caf03f263055fbbd14 Mon Sep 17 00:00:00 2001 From: David Vazgenovich Shakaryan Date: Tue, 21 Jul 2009 14:10:53 -0700 Subject: Initial import: Class MPD with connect method. --- mpdlib.rb | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 mpdlib.rb (limited to 'mpdlib.rb') 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 +# 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 -- cgit v1.2.3-70-g09d2