Compare commits

...

6 commits

Author SHA1 Message Date
Denis Knauf 8e2368bf95 example: mpd.connect. readline -> gets 2010-04-11 18:54:04 +02:00
Denis Knauf d185528889 VERSION 0.0.3 2010-04-11 18:48:38 +02:00
Denis Knauf 2d4d4a870e typo fixed 2010-04-11 18:48:10 +02:00
Denis Knauf 032b3dc04d mpd-example changed. uses librmpd 2010-04-11 18:31:00 +02:00
Denis Knauf 377ef00063 meta-data changed (homepage) 2010-04-11 18:22:37 +02:00
Denis Knauf 278a2ea3f3 README.md: MPD-example added 2010-04-07 00:14:20 +02:00
4 changed files with 25 additions and 7 deletions

View file

@ -1,8 +1,8 @@
Description Description
=========== ===========
lircr (pronounced 'lurker') is a LIRC client library for Ruby. It's simple, lircr (pronounced 'lurker') is a LIRC client library for Ruby. It is simple,
it's easy, it's fun. If you got LIRC, get lircr. I am not responsible if you it is easy, it is fun. If you got LIRC, get lircr. I am not responsible if you
grow more hair on your index finger or thumb. grow more hair on your index finger or thumb.
Usage Usage
@ -15,3 +15,21 @@ Usage
if event.name == "play" if event.name == "play"
system "xmms", "/av/music/3.mod" system "xmms", "/av/music/3.mod"
end end
Control your MPD:
require 'lirc'
require 'librmpd'
lirc = LIRC::Client.new
mpd = MPD.new 'localhost', 6600
mpd.connect
lirc.each do |event|
case event.name
when "play"
mpc.play
when "pause"
mpd.pause = !mpd.pause
when "stop"
mpd.stop
end
end

View file

@ -8,7 +8,7 @@ begin
gem.summary = %Q{LIRC client for Ruby} gem.summary = %Q{LIRC client for Ruby}
gem.description = %Q{} gem.description = %Q{}
gem.email = "Denis.Knauf@gmail.com" gem.email = "Denis.Knauf@gmail.com"
gem.homepage = "http://github.com/DenisKnauf/logan" gem.homepage = "http://github.com/DenisKnauf/lircr"
gem.authors = ["Denis Knauf", "Hans Fugal"] gem.authors = ["Denis Knauf", "Hans Fugal"]
gem.files = %w[AUTHORS README.md VERSION lib/**/*.rb test/**/*.rb] gem.files = %w[AUTHORS README.md VERSION lib/**/*.rb test/**/*.rb]
gem.require_paths = %w[test lib] gem.require_paths = %w[test lib]

View file

@ -1 +1 @@
0.0.2 0.0.3

View file

@ -2,13 +2,13 @@ require 'socket'
module LIRC module LIRC
class Client class Client
def initializer dev = nil def initialize dev = nil
dev ||= "/dev/lircd" dev ||= "/dev/lircd"
@sock = UNIXSocket.open dev @sock = UNIXSocket.new dev
end end
def next def next
Event.new @sock.readline Event.new @sock.gets
end end
def each_event def each_event