DBus-usage

From VideoLAN Wiki
Revision as of 05:59, 14 January 2010 by Hugo (talk | contribs) (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...')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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