aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/dot_local/bin/executable_tokodi
diff options
context:
space:
mode:
Diffstat (limited to 'dot_local/bin/executable_tokodi')
-rwxr-xr-xdot_local/bin/executable_tokodi22
1 files changed, 22 insertions, 0 deletions
diff --git a/dot_local/bin/executable_tokodi b/dot_local/bin/executable_tokodi
new file mode 100755
index 0000000..ce945de
--- /dev/null
+++ b/dot_local/bin/executable_tokodi
@@ -0,0 +1,22 @@
+#!/usr/bin/env sh
+
+if [ -z "$1" ]; then
+ url=$(wl-paste)
+elif [ "$1" = "-" ]; then
+ read -r url
+else
+ url="$1"
+fi
+
+case "$url" in
+*.m3u8*)
+ prefix=''
+ ;;
+*)
+ prefix='plugin://plugin.video.sendtokodi/?'
+ ;;
+esac
+
+payload="$(printf '{"jsonrpc":"2.0", "id": 1, "method":"Player.Open","params": {"item": {"file":"%s%s"}}}' "$prefix" "$url")"
+
+curl -u kodi:kodi 'http://ruiflix.pulpo:8080/jsonrpc' -X POST --data-raw "$payload" -H 'Content-Type: application/json'