-
-
Save dataolle/4207390 to your computer and use it in GitHub Desktop.
#!/bin/bash | |
#set url and port to the xbmc box webservice | |
XBMC_HOST="http://127.0.0.1:8080" | |
if [ "$1" = "" ]; then | |
echo -n "Insert URL: " | |
read url | |
else | |
url="$1" | |
fi | |
if [[ "$url" == *youtube.com* ]] | |
then | |
vid=$( echo "$url" | tr '?&#' '\n\n' | grep -e '^v=' | cut -d'=' -f2 ) | |
payload='{"jsonrpc": "2.0", "method": "Player.Open", "params":{"item": {"file" : "plugin://plugin.video.youtube/?action=play_video&videoid='$vid'" }}, "id" : "1"}' | |
elif [[ "$url" == *vimeo.com* ]] | |
then | |
vid=$( echo "$url" | awk -F"/" '{print ($(NF))}' ) | |
payload='{"jsonrpc": "2.0", "method": "Player.Open", "params":{"item": {"file" : "plugin://plugin.video.vimeo/?action=play_video&videoid='$vid'" }}, "id": "1" }' | |
else | |
payload='{ "jsonrpc": "2.0", "method": "Player.Open", "params": { "item": { "file": "'${url}'" }}, "id": 1 }' | |
fi | |
curl -v -u xbmc:password -d "$payload" -H "Content-type:application/json" -X POST "${XBMC_HOST}/jsonrpc" |
Nice little script with curl as the only dependency. Works great on my Openelec box.
Used with realdebrid-cli ( https://github.com/MrMitch/realdebrid-CLI ) i can now stream my files straight to my raspberry ! Thanks for your script !
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.
I wrote something similar too and vimeo version doesn't work and does not play video
this work:
http://your_ip:8080/jsonrpc?request={"jsonrpc":"2.0","id":1,"method":"Player.Open","params":{"item": {"file":"plugin://plugin.video.vimeo/play/?video_id=12345678"}}}
then url encore it to get:
http://your_ip:8080/jsonrpc?request={"jsonrpc":"2.0","id":1,"method":"Player.Open","params":{"item": {"file":"plugin:%2F%2Fplugin.video.vimeo%2Fplay%2F%3Fvideo_id%3D12345678"}}}
source: .kodi/addons/plugin.video.vimeo/docs/endpoints.md:
` ENDPOINTS
Videos
Play a video via ID
Syntax
plugin://plugin.video.vimeo/play/?video_id=[VID]
Example
https://vimeo.com/121465494
plugin://plugin.video.vimeo/play/?video_id=121465494
`
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!
Is often crash in Raspbmc and restarting Raspbmc:
curl: (52) Empty reply from server