Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- # Early exit on incorrect number of parameters
- [ "$#" -ne 1 ] && echo "Usage: kodiplay <url>" && exit 1
- readonly JSON='{"jsonrpc":"2.0","method":"Player.Open","id":1,"params":{"item":{"file":"'$1'"}}}'
- # When DEBUG is set, we add the -v flag to curl
- [ -z ${DEBUG+x} ] || DEBUG_FLAG="-v"
- # Load configuration from xbmc-client config file
- : ${CONFIG_FILE=$HOME/.config/xbmc-client/config}
- HOST=$(sed -n 's/host=//p' < $CONFIG_FILE)
- USER=$(sed -n 's/user=//p' < $CONFIG_FILE)
- PASS=$(sed -n 's/password=//p' < $CONFIG_FILE)
- # Send request to Kodi
- curl -s \
- $DEBUG_FLAG \
- -u $USER:$PASS \
- --data-binary $JSON \
- -H 'content-type: application/json;' \
- $HOST/jsonrpc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement