From 3a9cc468fad8aa1dfa3e6af865c0b824a9327634 Mon Sep 17 00:00:00 2001 From: Gardouille Date: Mon, 4 Jul 2022 17:35:22 +0200 Subject: [PATCH] Manage Kodi API port option --- kodi.controller.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/kodi.controller.sh b/kodi.controller.sh index f33c1dc..a0c591b 100755 --- a/kodi.controller.sh +++ b/kodi.controller.sh @@ -20,6 +20,7 @@ export DEBUG readonly USER_MULTIMEDIA_COMMAND_DEFAULT="toggle" readonly KODI_PROC_REGEXP="kodi.bin" readonly KODI_HOST_DEFAULT="127.0.0.1" +readonly KODI_PORT_DEFAULT="8080" ## Colors readonly PURPLE='\033[1;35m' @@ -62,6 +63,9 @@ OPTIONS : -h,--host Set the Kodi host to manage. + -p,--port + Set the Kodi API's port to use. + -d,--debug Enable debug messages. @@ -102,6 +106,12 @@ define_vars() { # {{{ readonly KODI_HOST="${KODI_HOST_DEFAULT}" fi ## }}} + ## If KODI_PORT wasn't defined (argument) {{{ + if [ -z "${KODI_PORT}" ]; then + ## Use default value + readonly KODI_PORT="${KODI_PORT_DEFAULT}" + fi + ## }}} ## If USER_MULTIMEDIA_COMMAND wasn't defined (argument) {{{ if [ -z "${USER_MULTIMEDIA_COMMAND}" ]; then ## Use default value @@ -224,6 +234,12 @@ if [ ! "${NBARGS}" -eq "0" ]; then ### Define var KODI_HOST="${1}" ;; + -p|--port ) ## Kodi API port + ### Move to the next argument + shift + ### Define var + KODI_PORT="${1}" + ;; --help ) ## help usage ## Exit after help informations