aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/home/.local/bin/tokodi
diff options
context:
space:
mode:
Diffstat (limited to 'home/.local/bin/tokodi')
-rwxr-xr-xhome/.local/bin/tokodi13
1 files changed, 13 insertions, 0 deletions
diff --git a/home/.local/bin/tokodi b/home/.local/bin/tokodi
new file mode 100755
index 0000000..738d77b
--- /dev/null
+++ b/home/.local/bin/tokodi
@@ -0,0 +1,13 @@
+#!/usr/bin/env sh
+
+if [ -z "$1" ]; then
+ url=$(xclip -o -selection clipboard)
+elif [ "$1" = "-" ]; then
+ read -r url
+else
+ url="$1"
+fi
+
+payload="$(printf '{"jsonrpc":"2.0", "id": 1, "method":"Player.Open","params": {"item": {"file":"%s"}}}' "$url")"
+
+curl -u kodi:kodi 'http://xbox.pulpo:8080/jsonrpc' -X POST --data-raw "$payload" -H 'Content-Type: application/json'