File: call_introspect.rb

package info (click to toggle)
ruby-dbus 0.16.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 520 kB
  • sloc: ruby: 3,786; sh: 53; makefile: 8
file content (31 lines) | stat: -rwxr-xr-x 765 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env ruby

require "dbus"

session_bus = DBus::SessionBus.instance

# Get the Rhythmbox service
rhythmbox = session_bus.service("org.gnome.Rhythmbox")

# Get the object from this service
player = rhythmbox.object("/org/gnome/Rhythmbox/Player")

if player.has_iface? "org.gnome.Rhythmbox.Player"
  puts "We have Rhythmbox Player interface"
end

player_with_iface = player["org.gnome.Rhythmbox.Player"]
p player_with_iface.getPlayingUri

# Maybe support default_iface=(iface_str) on an ProxyObject, so
# that this is possible?
player.default_iface = "org.gnome.Rhythmbox.Player"
puts "default_iface test:"
p player.getPlayingUri
player.on_signal("elapsedChanged") do |u|
  puts "elapsedChanged: #{u}"
end

main = DBus::Main.new
main << session_bus
main.run