Difference between revisions of "DBus-usage"

From VideoLAN Wiki
Jump to navigation Jump to search
Line 2: Line 2:
 
This bash script toggles between Play/Pause:
 
This bash script toggles between Play/Pause:
  
Stopepd -> Play
+
Stopped -> Play
  
 
Playing -> Pause
 
Playing -> Pause

Revision as of 21:30, 30 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:

Stopped -> 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