[WIP] Initial commit for qsgen3

This commit is contained in:
2025-05-30 20:37:56 +02:00
parent 106b66753f
commit 75105821fd
138 changed files with 12471 additions and 7 deletions

88
include/common/colors.inc Executable file
View File

@ -0,0 +1,88 @@
# Here you set the colors you want in the output of view and search
#
# Black 0;30 Dark Gray 1;30
# Blue 0;34 Light Blue 1;34
# Green 0;32 Light Green 1;32
# Cyan 0;36 Light Cyan 1;36
# Red 0;31 Light Red 1;31
# Purple 0;35 Light Purple 1;35
# Brown 0;33 Yellow 1;33
# Light Gray 0;37 White 1;37
BLACK="\033[0;30m"
RED="\033[0;31m"
GREEN="\033[0;32m"
YELLOW="\033[0;33m"
BLUE="\033[0;34m"
MAGENTA="\033[0;35m"
CYAN="\033[0;36m"
WHITE="\033[0;37m"
BOLD_BLACK="\033[1;30m"
BOLD_RED="\033[1;31m"
BOLD_GREEN="\033[1;32m"
BOLD_YELLOW="\033[1;33m"
BOLD_BLUE="\033[1;34m"
BOLD_MAGENTA="\033[1;35m"
BOLD_CYAN="\033[1;36m"
BOLD_WHITE="\033[1;37m"
BLACK_BG="\033[40m"
RED_BG="\033[41m"
GREEN_BG="\033[42m"
YELLOW_BG="\033[43m"
BLUE_BG="\033[44m"
MAGENTA_BG="\033[45m"
CYAN_BG="\033[46m"
WHITE_BG="\033[47m"
END="\033[0m"
Black="\033[0;30m"
Red="\033[0;31m"
Green="\033[0;32m"
Yellow="\033[0;33m"
Blue="\033[0;34m"
Magenta="\033[0;35m"
Cyan="\033[0;36m"
White="\033[0;37m"
Bold_Black="\033[1;30m"
Bold_Red="\033[1;31m"
Bold_Green="\033[1;32m"
Bold_Yellow="\033[1;33m"
Bold_Blue="\033[1;34m"
Bold_Magenta="\033[1;35m"
Bold_Cyan="\033[1;36m"
Bold_White="\033[1;37m"
Black_bg="\033[40m"
Red_bg="\033[41m"
Green_bg="\033[42m"
Yellow_bg="\033[43m"
Blue_bg="\033[44m"
Magenta_bg="\033[45m"
Cyan_bg="\033[46m"
White_bg="\033[47m"
End="\033[0m"
black="\033[0;30m"
red="\033[0;31m"
green="\033[0;32m"
yellow="\033[0;33m"
blue="\033[0;34m"
magenta="\033[0;35m"
cyan="\033[0;36m"
white="\033[0;37m"
bold_black="\033[1;30m"
bold_red="\033[1;31m"
bold_green="\033[1;32m"
bold_yellow="\033[1;33m"
bold_blue="\033[1;34m"
bold_magenta="\033[1;35m"
bold_cyan="\033[1;36m"
bold_white="\033[1;37m"
black_bg="\033[40m"
red_bg="\033[41m"
green_bg="\033[42m"
yellow_bg="\033[43m"
blue_bg="\033[44m"
magenta_bg="\033[45m"
cyan_bg="\033[46m"
white_bg="\033[47m"
end="\033[0m"

15
include/common/include Normal file
View File

@ -0,0 +1,15 @@
function include() {
# This function is used to include other functions that will normally be in
# ${HOME}/bin/include/
# Edit this path to reflect your installation
local inc_file=${HOME}/bin/include/${1}.inc
if [[ ! -f ${inc_file} ]]; then
local inc_opt=$( echo ${1} | cut -d\/ -f2 )
echo "Supplied option \"${inc_opt}\" is not a valid include."
else
builtin source ${inc_file} ${2}
fi
}

View File

@ -0,0 +1,11 @@
# Converts a --with=option,option2 into an array
# Usage: InputToArray <input-string>
# Returns: $InputArray
function InputToArray () {
if [[ ${@} =~ "--with" ]]; then
InputArray=( $( echo ${@} | cut -d= -f2 | sed -e 's/\,/\ /g' ) )
fi
}

7
include/common/loggy.inc Normal file
View File

@ -0,0 +1,7 @@
# Function: LOGGER
# Usage: loggy <message>
function loggy () {
echo "$$ - $(date +%T) - ${KODIVERSION} - ${@}" >> ${LOGGYLOGFILE}
}

View File

@ -0,0 +1,9 @@
# This function creates an array of a *nix path
# Example: /home/user/bin becomes an array of ( home user bin )
function slash_to_array () {
sta=( $( echo ${1} | sed -e "s/\//\ /g" ) )
# return ${sta}
}

39
include/common/zini Normal file
View File

@ -0,0 +1,39 @@
# zini function to parse INI files and store their content in an associative array
zini() {
local ini_path="$1"
typeset -gA config
# Check if the file exists
if [[ ! -f "$ini_path" ]]; then
echo "Configuration file not found: $ini_path"
return 1
fi
local current_section=""
local line key value composite_key
# Read the INI file line by line
while IFS= read -r line || [[ -n $line ]]; do
line=$(echo $line | xargs) # Trim whitespace
# Skip empty lines and comments
[[ -z "$line" || "$line" == \;* ]] && continue
# Detect section headers
if [[ "$line" == \[*\]* ]]; then
current_section="${line:1:-1}"
else
# Parse key-value pairs
key=${line%%=*}
value=${line#*=}
key=$(echo $key | xargs) # Trim key
value=$(echo $value | xargs) # Trim value
# Store in associative array with 'section_key' format
composite_key="${current_section}_${key}"
config[$composite_key]="$value"
fi
done < "$ini_path"
# echo "Configuration loaded."
}