#!/bin/bash
if [ $# -ne 1 ]; then
echo "To play VIDEO"
echo " xbmc-send --host=RaspberryPI_IP --port=9777 --action=\\"PlayMedia(plugin://plugin.video.youtube/?action=play_video&videoid=p1QUhxpgUds)\\""
echo "To show IMAGE"
echo " xbmc-send --host=RaspberryPI_IP --port=9777 --action=\\"ShowPicture(http://i.imgur.com/EuMWHtm.png)\\""
echo "To show WINDOW"
echo " xbmc-send --host=RaspberryPI_IP --port=9777 --action=\\"ActivateWindow(Weather)\\""
fi
youtube=`echo $1 | grep youtube | grep -v grep | wc -l`
if [ $youtube -gt 0 ]; then
Vid=`echo $1 | rev | cut -d= -f1 | rev`
echo "This is the video ID I would ask it to play $Vid"
echo "xbmc-send --host=RaspberryPI_IP --port=9777 --action=\\"PlayMedia(plugin://plugin.video.youtube/?action=play_video&videoid=$Vid)\\"" | sh
else
if [ $1 == "s" ]; then
control=`echo stop`
echo "xbmc-send --host=RaspberryPI_IP --port=9777 --action=\\"PlayerControl($control)\\"" | sh
elif [ $1 == "p" ]; then
control=`echo play`
echo "xbmc-send --host=RaspberryPI_IP --port=9777 --action=\\"PlayerControl($control)\\"" | sh
fi
fi