Skip to content

Instantly share code, notes, and snippets.

@marxjohnson
Last active November 27, 2016 21:22
Show Gist options
  • Save marxjohnson/411b09a8388a8784d41fbaf7a2bc1df8 to your computer and use it in GitHub Desktop.
Save marxjohnson/411b09a8388a8784d41fbaf7a2bc1df8 to your computer and use it in GitHub Desktop.
Kodi Blu-Ray playback
#!/bin/bash
# Kill any existing streams
killall makemkvcon
# Display a notification while MakeMKV scans the disc
curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"GUI.ShowNotification","params":{"title":"Loading","message":"Scanning disc, please wait...", "displaytime": 30000},"id":1}' http://localhost:8080/jsonrpc
makemkvcon stream dev:/dev/sr0 &
# Wait until port 51000 has a service running on it (this is the port MakeMKV uses for the UPnP share).
while [ -z "$(netstat -a | grep 51000)" ]
do
sleep 1
done
curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"GUI.ShowNotification","params":{"title":"Loaded","message":"Disc loaded!"},"id":1}' http://localhost:8080/jsonrpc
# Switch Kodi to the window for the UPnP share (I looked up the ID in advance).
curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"GUI.ActivateWindow","id":1,"params":{"window":"videos","parameters": ["\"upnp://6FF32089-DD72-4fa8-8B55-A0F3AF1BB5FF/\""]}}' http://localhost:8080/jsonrpc
#!/bin/bash
# Call the main script and exit, so that Kodi doesn't sit with "Opening Stream"
/home/xbmc/disc_script.sh & exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment