Difference between revisions of "DBus-usage"

From VideoLAN Wiki
Jump to navigation Jump to search
(Created page with 'The following is a usage example of how to control VLC though DBUS, by simple using dbus-send. This bash script toggles between Play/Pause: Stopepd -> Play Playing -> Pause Pa...')
 
Line 16: Line 16:
 
fi
 
fi
 
</pre>
 
</pre>
 +
 +
== See also ==
 +
* [[DBus-spec]]

Revision as of 06:01, 14 January 2010

The following is a usage example of how to control VLC though DBUS, by simple using dbus-send. This bash script toggles between Play/Pause:

Stopepd -> Play

Playing -> Pause

Pause -> Play

#!/bin/bash
if [ -z `dbus-send --print-reply --session --dest=org.mpris.vlc /Player org.freedesktop.MediaPlayer.GetStatus | grep "int32 2"` ]; then
        dbus-send --print-reply --session --dest=org.mpris.vlc /Player org.freedesktop.MediaPlayer.Pause
else
    	dbus-send --print-reply --session --dest=org.mpris.vlc /Player org.freedesktop.MediaPlayer.Play
fi

See also