From 1920f79ae7e7dae6d28ae0de55b553402878bd39 Mon Sep 17 00:00:00 2001
From: salixor <257-salixor@users.noreply.git.iiens.net>
Date: Mon, 8 May 2023 13:28:35 +0200
Subject: [PATCH] Remove dep to python3 in favor of jq

---
 stpkg | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/stpkg b/stpkg
index c26f531..f230cfd 100755
--- a/stpkg
+++ b/stpkg
@@ -68,7 +68,7 @@ require() {
     done
 }
 require \
-    md5sum mktemp column uuidgen convert montage identify python3 curl ffmpeg \
+    md5sum mktemp column uuidgen convert montage identify curl ffmpeg \
     sed tr git sponge ls find jq chmod cat expr iconv bc
 __grep=`which egrep`
 if [ -z $__grep ]; then
@@ -151,8 +151,7 @@ default_index() {
 }
 
 validate_token_internal() {
-    curl -s -X POST "https://$STPKG_HOMESERV/_matrix/media/r0/upload?access_token=$STPKG_TOKEN" | \
-        python3 -c "import sys, json; print(json.load(sys.stdin)['errcode'])" # TODO: Use jq here
+    curl -s -X POST "https://$STPKG_HOMESERV/_matrix/media/r0/upload?access_token=$STPKG_TOKEN" | jq -r ".errcode"
 }
 
 validate_token() {
@@ -232,10 +231,9 @@ __upload_file() {
         validate_token # Validate token, will exit if invalid
     fi
 
-    # TODO: Use jq here
     MXC=$(curl -s -X POST -H \
         "Content-Type: $TYPE" --data-binary "@$FILE" "https://$STPKG_HOMESERV/_matrix/media/r0/upload?access_token=$STPKG_TOKEN" | \
-        tee /tmp/toto | python -c "import sys, json; print(json.load(sys.stdin)['content_uri'])")
+        tee /tmp/toto | jq -r ".content_uri")
     [ $? -ne 0 ] && die "Failed to upload sticker $NAME for pack $PACK_NAME to $STPKG_HOMESERV"
 }
 
-- 
GitLab