-
Notifications
You must be signed in to change notification settings - Fork 2
Component:Ruby bindings
For an example on how to write a client in ruby you can have a look at the euphoria client. If you're new to ruby then you might want to have a look at Why's Poignant Guide to Ruby or Programming Ruby - The Pragmatic Programmer's Guide before you get your hands dirty.
rdoc generated documentation can be found at http://people.xmms2.org/~tilman/ruby-api-docs-0.7/.
require 'xmmsclient'
xmms = nil
begin
xmms = Xmms::Client.new('client_name').connect(ENV['XMMS_PATH'])
rescue Xmms::Client::ClientError
$stderr.puts 'Failed to connect to XMMS2 daemon.'
end
- xmms is an object of Xmms::Client class (see Connecting section above).
- res is a return value.
Broadcast is a message that XMMS2 will send to client when something changed. Playback status, new items in playlists, etc.
Sample usage:
xmms.broadcast_quit.notifier do |res|
# This will not execute immediately.
# Only when you application receive broadcast_quit broadcast.
puts 'Server was shutdown.'
false
end
Keep in mind that you need to return true or false inside a notifier block. true means you want to receive events of this type in the future. While false means you will not receive events of this type anymore. Ruby will use last calculated value as a result if you don't explicitly specify it which may result in weird error messages.
For information about specific broadcasts see Ruby_bindings/Broadcasts.
TODO: write something
Methods in this sections are useful when you want actively query XMMS2 for something (reading song metadata by it's id, etc.).
For information about specific queries see Ruby_bindings/Other queries.
Content is available under GNU Free Documentation License 1.2 unless otherwise noted.
- Community
- Development