From 32caa9140936cd01b15d7ba95359fbbf3e4cad73 Mon Sep 17 00:00:00 2001
From: Adar Nimrod <nimrod@shore.co.il>
Date: Sun, 28 Apr 2024 09:33:42 +0300
Subject: [PATCH] Fix the Kodi library scan function.

The script in Poquita only scans the audio library. The one in the
Transmission image requires some environment variables and also sends a
notification to Nextcloud. So fallback to using cURL.
---
 .bashrc | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/.bashrc b/.bashrc
index 6a3faed..e6fe812 100644
--- a/.bashrc
+++ b/.bashrc
@@ -116,7 +116,6 @@ alias green="printf '\e[1;92m%s\e[0m\n'"
 alias hcl2json='json2hcl -reverse'
 alias hostlocal='docker run --rm --privileged --net=host docker.io/gliderlabs/hostlocal'
 alias jjb='jenkins-jobs'
-alias kodi_scan="docker --host=ssh://kodi.shore.co.il exec poquita-poquita-1 kodi_scan"
 alias l='ls -F'
 alias la='ls -AF'
 alias lh='ls -lhAS'
@@ -230,6 +229,13 @@ gen_csr () {
     openssl req -new -newkey rsa:4096 -nodes -out "$name.csr" -keyout "$name.key"
 }
 
+kodi_scan () {
+    # shellcheck disable=SC1083
+    ssh kodi.shore.co.il curl --silent --fail --show-error --json \'{\"jsonrpc\": \"2.0\", \"id\": \"transmission\", \"method\": \"VideoLibrary.Scan\"}\' http://127.0.0.1:8080/jsonrpc; echo
+    # shellcheck disable=SC1083
+    ssh kodi.shore.co.il curl --silent --fail --show-error --json \'{\"jsonrpc\": \"2.0\", \"id\": \"transmission\", \"method\": \"AudioLibrary.Scan\"}\' http://127.0.0.1:8080/jsonrpc; echo
+}
+
 match_ssl_pair () {
     if [ "$#" -ne 2 ]
     then
-- 
GitLab