Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
send url to xbmc's json-rpc service for playback on the big screen
#set url and port to the xbmc box webservice
if [ "$1" = "" ]; then
echo -n "Insert URL: "
read url
if [[ "$url" == ** ]]
vid=$( echo "$url" | tr '?&#' '\n\n' | grep -e '^v=' | cut -d'=' -f2 )
payload='{"jsonrpc": "2.0", "method": "Player.Open", "params":{"item": {"file" : "plugin://'$vid'" }}, "id" : "1"}'
elif [[ "$url" == ** ]]
vid=$( echo "$url" | awk -F"/" '{print ($(NF))}' )
payload='{"jsonrpc": "2.0", "method": "Player.Open", "params":{"item": {"file" : "plugin://'$vid'" }}, "id": "1" }'
payload='{ "jsonrpc": "2.0", "method": "Player.Open", "params": { "item": { "file": "'${url}'" }}, "id": 1 }'
curl -v -u xbmc:password -d "$payload" -H "Content-type:application/json" -X POST "${XBMC_HOST}/jsonrpc"

This comment has been minimized.

Copy link

ghost commented Mar 3, 2014

Is often crash in Raspbmc and restarting Raspbmc:

  • upload completely sent off: 158 out of 158 bytes
  • Empty reply from server
  • Connection #0 to host left intact
    curl: (52) Empty reply from server

This comment has been minimized.

Copy link

antoinerg commented May 25, 2014

Nice little script with curl as the only dependency. Works great on my Openelec box.


This comment has been minimized.

Copy link

maxime1992 commented May 9, 2015

Used with realdebrid-cli ( ) i can now stream my files straight to my raspberry ! Thanks for your script !


This comment has been minimized.

Copy link

spiderbit commented May 16, 2015

sadly it does not work for me with vimeo, it sends the string I get a OK but it does not start the video.
I wrote something similar which I tried to modify also from the youtube version to the vimeo version with same result.

Is it pollible that it only works if I am logged in? It would make 0 sense because I can play from the plugin gui videos without logging in.

At least I know that its not my jsonrpc string thats wrong.


This comment has been minimized.

Copy link

fedmich commented Jun 9, 2016

I wrote something similar too and vimeo version doesn't work and does not play video


This comment has been minimized.

Copy link

amrx06 commented Jun 14, 2016

this work:
http://your_ip:8080/jsonrpc?request={"jsonrpc":"2.0","id":1,"method":"Player.Open","params":{"item": {"file":"plugin://"}}}

then url encore it to get:
http://your_ip:8080/jsonrpc?request={"jsonrpc":"2.0","id":1,"method":"Player.Open","params":{"item": {"file":""}}}

source: .kodi/addons/


Play a video via ID





This comment has been minimized.

Copy link

aviwad commented Dec 10, 2017

Is there any way, we can, say, in one command, search for a youtube video and automatically play the first result? I wanna incorporate this in my Raspberry Pi with voice commands, that's why! thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.