Appendix B. D-Bus Interface

D-Bus Examples

On Linux® a D-Bus-interface can be used to control Kid3 by scripts. Scripts can be written in any language with D-Bus-bindings (e.g. in Python) and can be added to the User Actions to extend the functionality of Kid3.

The artist in tag 2 of the current file can be set to the value "One Hit Wonder" with the following code:

Shell
dbus-send --dest=org.kde.kid3 --print-reply=literal \
/Kid3 org.kde.Kid3.setFrame int32:2 string:'Artist' \
string:'One Hit Wonder'

or easier with Qt™'s qdbus (qdbusviewer can be used to explore the interface in a GUI):

qdbus org.kde.kid3 /Kid3 setFrame 2 Artist \
'One Hit Wonder'
Python
import dbus
kid3 = dbus.SessionBus().get_object(
  'org.kde.kid3', '/Kid3')
kid3.setFrame(2, 'Artist', 'One Hit Wonder')
Perl
use Net::DBus;
$kid3 = Net::DBus->session->get_service(
  "org.kde.kid3")->get_object(
  "/Kid3", "org.kde.Kid3");
$kid3->setFrame(2, "Artist", "One Hit Wonder");