Commit ada9939d authored by Jean-Paul Saman's avatar Jean-Paul Saman

dbus: Add MprisVersion 2 test script.

parent 33132b6f
#!/bin/bash
#############################################################################
# Test MPRIS v2.0 dbus communication with vlc
#############################################################################
# Copyright (C) 2009, M2X BV
# Author: Jean-Paul Saman <jean-paul.saman at m2x.nl>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
#############################################################################
verbose="--print-reply=3"
medialist=$*
if test -z "$medialist"; then
echo "Provide a MRL for testing, eg: mpris_v1.sh file://myvideo.mpeg file://myvideo2.mpeg"
echo "Make sure vlc is started before running this test script, eg: vlc --extraintf=dbus"
exit 1
fi
mpris_methodcall()
{
local object=$1
local method=$2
shift
shift
local args=$*
echo -n "Object $object method org.freedesktop.MediaPlayer.$method $args...["
dbus-send $verbose --type=method_call --dest=org.mpris.vlc $object org.freedesktop.MediaPlayer.$method $args
if test "$?" -eq 0; then
echo "]... pass"
else
echo "]... fail"
fi
sleep 3
}
# ROOT object
mpris_methodcall "/" "MprisVersion"
mpris_methodcall "/" "Identity"
mpris_methodcall "/Player" "GetCaps"
mpris_methodcall "/TrackList" "GetLength"
mpris_methodcall "/TrackList" "SetLoop" "boolean:true"
mpris_methodcall "/Player" "GetStatus"
count=0
for media in $medialist; do
if test $count -eq 0; then
mpris_methodcall "/TrackList" "AddTrack" "string:$media" "boolean:true"
else
mpris_methodcall "/TrackList" "AddTrack" "string:$media" "boolean:false"
fi
mpris_methodcall "/TrackList" "GetLength"
mpris_methodcall "/TrackList" "GetCurrentTrack"
mpris_methodcall "/TrackList" "GetMetadata" int32:$count
count=$(($count+1))
sleep 10
done
mpris_methodcall "/Player" "Next"
mpris_methodcall "/Player" "GetMetadata"
mpris_methodcall "/Player" "Prev"
mpris_methodcall "/Player" "Pause"
mpris_methodcall "/Player" "GetStatus"
mpris_methodcall "/Player" "Pause"
mpris_methodcall "/TrackList" "SetRandom" "boolean:true"
mpris_methodcall "/Player" "Next"
mpris_methodcall "/Player" "Repeat" "boolean:true"
mpris_methodcall "/Player" "GetStatus"
mpris_methodcall "/TrackList" "SetRandom" "boolean:false"
mpris_methodcall "/TrackList" "SetLoop" "boolean:false"
mpris_methodcall "/Player" "Stop"
mpris_methodcall "/Player" "GetStatus"
mpris_methodcall "/Player" "Play"
mpris_methodcall "/Player" "GetRate"
for rate in 0.5 2.0 4.0 1.0 0.5 -1.0 -2.0 1; do
mpris_methodcall "/Player" "SetRate" double:$rate
mpris_methodcall "/Player" "GetRate"
done
mpris_methodcall "/ES" "CountVideoES"
mpris_methodcall "/ES" "CountAudioES"
mpris_methodcall "/ES" "CountSubtitles"
for es in 1 0; do
mpris_methodcall "/ES" "SetVideoES" int32:$es
mpris_methodcall "/ES" "GetVideoES"
mpris_methodcall "/ES" "SetAudioES" int32:$es
mpris_methodcall "/ES" "GetAudioES"
mpris_methodcall "/ES" "SetSubtitleES" int32:$es
mpris_methodcall "/ES" "GetSubtitleES"
done
for track in 0 1 2 3 4; do
mpris_methodcall "/ES" "GetEsMetadata" int32:$track
done
mpris_methodcall "/Display" "Fullscreen"
mpris_methodcall "/Display" "SetAspectRatio" string:"1:1"
mpris_methodcall "/Display" "GetAspectRatio"
mpris_methodcall "/Display" "SetAspectRatio" string:"4:3"
mpris_methodcall "/Display" "GetAspectRatio"
mpris_methodcall "/Display" "SetAspectRatio" string:"16:9"
mpris_methodcall "/Display" "GetAspectRatio"
mpris_methodcall "/Display" "SetAspectRatio" string:"221:100"
mpris_methodcall "/Display" "GetAspectRatio"
mpris_methodcall "/Display" "SetAspectRatio" string:"5:4"
mpris_methodcall "/Display" "GetAspectRatio"
mpris_methodcall "/Display" "SetAspectRatio" string:"1:1"
mpris_methodcall "/Display" "GetAspectRatio"
mpris_methodcall "/Display" "Fullscreen"
for vol in 0 10 20 30 40 50 60 70 80 90 100; do
mpris_methodcall "/Player" "VolumeSet" int32:$vol
done
mpris_methodcall "/Player" "VolumeSet" int32:50
mpris_methodcall "/Player" "VolumeGet"
for channel in 0 1 2 3 4 5 1; do
mpris_methodcall "/Display" "SetAudioChannel" int:$channel
mpris_methodcall "/Display" "GetAudioChannel"
done
mpris_methodcall "/Player" "PositionSet" int32:100
mpris_methodcall "/Player" "PositionGet"
mpris_methodcall "/Player" "Stop"
sleep 5
count=0
for media in $medialist; do
mpris_methodcall "/TrackList" "DelTrack" int32:$count
mpris_methodcall "/TrackList" "GetLength"
count=$(($count+1))
done
mpris_methodcall "/TrackList" "GetLength"
mpris_methodcall "/" "Quit"
exit 0
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment